views:

74

answers:

4

Our solution has several (10+) C# projects. Each has a reference to the CAB extension library, with the reference pointing to the DLLs in the library's release folders. Each project has between four and seven such references.

We'd like to make some changes to the library; but to debug the changes, we'll need to build a debug version of the library and refer to that. I'd like to add the library's projects to our solution and change each of the DLL references to a project reference.

Is it possible to perform a 'find and replace' on the existing references, or will I have to do it by hand?

+2  A: 

There isn't such a feature in the VS IDE.

However, as a .csproj file is just an XML document it is possible to do such a global search and replace in a scripted fashion e.g. by changing one file to observe the before and after states then running sed over the remainder.

For a one-off, going to the extent of writing a script to load the XML and making the substitutions by DOM manipulation is probably overkill.

Steve Gilham
+1  A: 

Take a look at Jared's answer to this SO thread. That approach will likely work for you.

JP Alioto
A: 

If you download CI Factory, it just so happens that there is a nant function in there called FixUpThirdPartyRefs which you could use or tweak to help you do this. So you could just setup nant and use that function.

It is part of the power tools with CI Factory: http://www.cifactory.org/joomla/index.php?option=com_content&task=view&id=29&Itemid=41

AaronLS
A: 

Why don't you just replace DLLs in library's release folder with debug version temporary ? I assume that you have local development environment.

EDIT: You could: 1. develop all time with debug version of library 2. make updating references in *.csproj more flexible 3. make file system location of library files more flexible

On point 3: If the path to your library dlls contains "release" and if debug and release library folder structure is the same than change from release could be made by just renaming folder "release" to "release.original" and "debug" to "release".

I would probably choose option 1 and all time develop with debug assemblies. Release build would use just for final testing and deploy to customer. Debug and release dlls are not that different.

Petar Repac
There are actually several such folders, and I'd have to do it after each change, so it would still be a pain. I've updated the question.
Simon