开发者

automate adding references in large VS solution

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 开发者_如何学Pythonthe 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜