views:

97

answers:

3

Hi all,

during development of our application we use a branching structure and while we are developing another team is using earlier builds of our software to create content with it.

To facilitate easy swapping between builds and teams I was hoping to use empty Hintpaths in the content projects' csproj files so that they can use our GAC installed assemblies to build against and in the meantime add a reference path to the projects for our use during development and test cycles where we don't want any assemblies installed in the GAC.

However, it seems reference paths are not stored in the csproj file and thus don't get sourcecontrolled. Since there will be extensive branching it would be less than ideal to have to set all reference paths again when a developer pulls another branch from sourcecontrol.

I've been searching for a bit now and can't seem to find ways to do this. Anybody know of a way to force the reference path in and out of sourcecontrol?

We're talking Visual Studio 2008 and TFS 2008 here.

Cheers, Anton.

A: 

The references are stored in the *.csproj file. The nodes are ItemGroup/Reference...

Thomas

Thomas Weller
The references are and those Hintpaths are the ones I empty, so the content team will build against the Assemblies in the GAC. The Project's reference paths are not (or do not seem to be)... and those are what the question is about.
Anton
A: 

This is pretty simple--we do this in our shop.

First, in the Workspace (using Windows Explorer, browse to the Solution folder), create a folder. We name it "Referenced Assemblies". In here, drop all your DLLs.

Now, in the Solution, add a new folder to match the one created in Windows Explorer. Into that folder, add all the DLLs you just dropped in.

Finally, in each project, set up your references to use the DLLs that were added to the solution.

Now your project references DLLs that are part of the solution, so that when the build runs, it will grab the DLL from Source Control to generate the build.

Also, I'd recommend not using the GAC at all if you can avoid it. In my experience, reference behavior is strange. It seems references go first to the GAC, then to the DLL in the local folder, meaning that if the DLL is updated, the one in the GAC is used instead of the DLL in the local folder (which is likely the updated one).

Russ
I had already considered this but it introduces some extra work for the content team I'd rather prevent, but I have been doing some more searching and I can't seem to find an easier way to do this, so I may end up using it. First I'll experiment some more :)
Anton
It really is the easiest thing--it can be automated by creating a build that builds the initial project, checks the DLLs out of the target solution and copies the new compiled DLLs into the target source control, but setting this up may be overkill.Unless you have a large number of DLLs to deal with, the extra work is not really significant.
Russ
+1  A: 

Ok, I seem to be a little clearer in the head after a good night's sleep, took the logical step, namely investigate where exactly the information was stored and how. It turned out the information was stored in the .user file for the project in the project's folder and as it turens out this file contains mbsuild xml.

I then did what I wanted as follows:

  • Create the Reference path as I required it to facilitate both scenarios without any work.
  • Browse to the Project's .user file
  • Copy the PropertyGroup containing the ReferencePath
  • Paste the PropertyGroup in all the necessary Projects' .csproj xml.
  • Reload and build.

Done.

Anton
I was just considering trying this out after discovering that the ReferencePath node in the .user file looks like something that I would see in a project file. Now I feel a little more confident going in this possible direction.
jpierson
One additional note. When you copy the entire PropertyGroup it will be removed under some circumstances (haven't exactly pinpointed them yet). When you put the ReferencePath hnode in an existing PropertyGroup it will not be removed. At least that's what it seems like to me thus far.
Anton