views:

22

answers:

1

I'm working on a VS solution with 100+ projects in C#. I'm currently migrating it from VS 2008 to VS 2010. There is some work to be done because a lot of the projects use Enterprise Library 4 (which has to be upgraded to 5.0) and WCSF 2008 (which has to be upgraded to SCSF 2010). I'm going through the SCSF upgrade instructions, and one involves doing this:

Add a reference to the following Service Location assembly in each project that has a reference to an Enterprise Library assembly.

Microsoft.Practices.ServiceLocation.dll

Is there any way to do this without going through the IDE? I mean, opening up each of 100-odd projects, then checking the references, then adding a reference if necessary, is one way of doing it, but is there a faster way? I was thinking along the lines of doing a search over the project files for a particular reference, then doing an insert if it was found.

If you've done this kind of thing before, suggestions would be very welcome. Thanks.

A: 

If you want to do this through the IDE, you can write a macro using VSProject.References to add/remove references as necessary.

However, C# project files (.csproj) are just XML, so you may be able to write a simple utility that can adjust the file as necessary using the standard XML classes.

Aaron Marten
Thanks. Do you have any idea of a good reference for getting started with VS macros? It's something I've never tried.
draconis
Here's the official MSDN documentation: http://msdn.microsoft.com/en-us/library/b4c73967.aspxWorking with Visual Studio 2005 (still almost entirely applicable to 2010) is also a good resource. http://www.amazon.com/Working-Microsoft-Visual-Studio-2005/dp/0735623155
Aaron Marten