简体   繁体   中英

Build a solution folder with MSBuild

we have a solution file that contains some solution folders : libraries, unit-tests, applications...

With VS2010 we can build only the projects of a given folder by right-clicking on it and using "build" or "rebuild".

This is perfect on the developers' workstations, and we'd like to do the same on the continuous-integration server which uses MSBuild .

So, can we build a solution folder with MSBuild?

Or will we have to create a dedicated solution for each folder?

Thanks in advance for any help.

FINAL EDIT : the conclusion of the below responses is that their is no built-in way to do that but some workarounds:

  • create a dedicated solution with only the selected projects,
  • use a dedicated csproj that will build the selected projects,
  • add a new project which will reference the selected projects in the existing solution file.

I've chosen to use a dedicated solution file as it is the less intrusive and tricky way, though not the more flexible (the dedicated csproj solution should offer full control).

Yes you can build Solutions folders using MSBUILD

msbuild "framework.sln" /t:First\Project:Build

Will build the Project in the Folder called First, HOWEVER disk folders and soltions folders must match (I tried it for my solution where they dont first)

So all youd have to do is choose a project that has all the other projects in that folder as dependencies.

Also see: http://msdn.microsoft.com/en-us/library/ms164311.aspx

The short answer is:

Yes , if you want to build specific set of projects (grouped together in a VS solution) with plain MSBuild you will have to create a dedicated MSBuild.proj for each specific set of projects you want to build.

You will not have to create (and maintain) VS solutions to support your build but in the end it's the same (MSBuild.proj vs. VS solution).

I have a similar scenario with a set of 60+ .NET projects (.btprpj BizTalk). For developing in VS these projects are currently organized in 12 VS solutions.

For automated build and deploy I created a set of 50+ MSBuild.proj scripts to target every single component (or set of components) I need.

MSBuild offers a lot of possibilities for automating all the stuff around the actual build of the VS projects (export from VCS, etc.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM