Is there an automated way of updating a Visual Studio project file to contain all files in the source tree?
We have one 开发者_Go百科project file (unit tests) that has lots of files in it. The files are arranged on disk in sub folders and we have folders in the project that matches these.
Every time we merge in from one of our many working branches, we have to update this project file by hand to add all new unit test files, as merging it never works.
So how to I avoid having to add the new files to each folder in the project by hand.
Yes. The project file is an msbuild file and the files to compile are an ItemGroup. You can change the item group to be a wildcard like so.
<ItemGroup>
<Compile Include="*.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
To recurse change the wildcard to "**\*.cs"
This is entirely an msbuild thing - You'll probably lose intellisence and Visual studio will probably reformat if you add a file manually.
精彩评论