开发者

Skip a project while building a solution using msbuild 3.5

I have a solution with a number of libraries + web site on folder.

When I use msbuil vs. this solution it precompiles web site to a new folder name PrecompiledWeb. I want to skip it, just b开发者_如何学JAVAuild all libraries.

How can I do that?


I would setup either a special target or perhaps a different msbuild file.

I use one .msbuild file and several different batch files, that way I can build specific parts of my application or the entire thing just by using a different batch file.

In your .msbuild file, you could have two targets, one for a full build and one for just the libs:

<Target Name="FullBuild">
  <MSBuild Projects="YourSolution.sln" />
</Target>

<Target Name="LibBuild">
  <MSBuild Projects="YourLibProject1.csproj" />
  <MSBuild Projects="YourLibProject2.csproj" />
  <MSBuild Projects="YourLibProject3.csproj" />
</Target>

So, you can call msbuild with either the FullBuild target which will build your entire solution, or with LibBuild which will build the specific projects you want.

Batch files might look like this:

msbuild.exe /t:LibBuild

msbuild.exe /t:FullBuild


You should be able to do this by creating a new configuration (LibOnly) and in the Visual Studio Configuration manager only check the projects that you want to build. Then from the command line:

msbuild.exe YourSolution.sln /p:Configuration=LibOnly

As the previous commenter mentioned you can alwyas create your own MSBuild file to specify which projects to build. I think that's a good approach, I don't like building solution files.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜