.NET Framework Bookmark and Share   
 index > MSBuild > use msbuild.exe to build part of projects under the same solution
 

use msbuild.exe to build part of projects under the same solution

i need to build projects under the same solution. however, msbuild.exe does not support setup project and report project. what i am trying to do is to specify which project needs to be built and which one should be ingored. I guess this should be be configure in xml file, eg. *.build

but how to achieve this?

thanks

msbuild

Hi 'msbuild',

You can invoke MSBuild on the solution once for each project you want, specifying the project name each time. I don't have the syntax handy, but essentially set the environment variable "msbuildemitsolution" to "1" to emit the temporary .sln.proj that MSBuild creates from the .sln. Take a look in there (it's pretty horrible - not intended for human consumption) and you'll see there's targets for each project. You can build the solution specifying a particular project by specifying its target, using the /t switch on msbuild.exe.

We don't advise that people pick up and modify the .sln.proj directly because it's an internal artefact that will change from version to version; also it won't keep in sync with changes to the .sln.

Getting reporting projects and setup projects and solution filesand .vcproj to support MSBuild is something we are working on. MSBuild is for certain the Microsoft build platform going forward; it's a matter of convincing the teams that own these files to make converting them a priority over other features. In the meantime, I apologize for the hassle the incompatible formats produce.

Dan

DanMoseley - MSFT

If the solution format would have been MSBuild compatible, you would just have added a Condition="$(BuildingInsideVisualStudio)= true" to the unsupported project types.

However, as the solution format isnot msbuild compatible, it is not this simple as msbuild transforms the solution file into a msbuild compatible project file in-memory, and this is automagically performed.

You can however get msbuild to dump the generated file to disk by setting an environment variable MSBuildEmitSolution to 1 and then do the build operation.

It might be possible to manually modify this generated project file and add Condition attributes appropriately, but this is just speculations..

Easier is to build using devenv (which obviously means that Visual studio needs to be installed)

Simon Dahlbacka

thanks Simon

but devenv is not an allowed option to me because we could not guarantee vs studio 2005 on each machine.

cheers



msbuild

so then try my other suggestion.. ?
Simon Dahlbacka

Hi 'msbuild',

You can invoke MSBuild on the solution once for each project you want, specifying the project name each time. I don't have the syntax handy, but essentially set the environment variable "msbuildemitsolution" to "1" to emit the temporary .sln.proj that MSBuild creates from the .sln. Take a look in there (it's pretty horrible - not intended for human consumption) and you'll see there's targets for each project. You can build the solution specifying a particular project by specifying its target, using the /t switch on msbuild.exe.

We don't advise that people pick up and modify the .sln.proj directly because it's an internal artefact that will change from version to version; also it won't keep in sync with changes to the .sln.

Getting reporting projects and setup projects and solution filesand .vcproj to support MSBuild is something we are working on. MSBuild is for certain the Microsoft build platform going forward; it's a matter of convincing the teams that own these files to make converting them a priority over other features. In the meantime, I apologize for the hassle the incompatible formats produce.

Dan

DanMoseley - MSFT

You can use google to search for other answers

Custom Search

More Threads

• RecursiveDir Question
• Warning: (dll) does not contain any types that can be unregistered for COM Interop
• Msbuild to reference data service reference and web.config
• Build not working due to dll reference.
• Dynamic Templates
• Referencing shared .target file from several .csproj files - what path to use to find the .target file from all builds?
• commandline build fails, ide does not
• Relative paths in imported projects - documenttation mismatch??
• Case Sensitivity
• MSBUILD logger error MSB4104