Share via


how to disable auto-build dependency in msbuild?

Question

Wednesday, July 14, 2010 2:57 AM

if project A depends on project B(via project reference), msbuild will automatically build project B when I am building project A,

are there any way to disable this behavior? I just want to build project A alone.

All replies (5)

Monday, July 19, 2010 5:56 AM ✅Answered

Hello Chao,

Thanks for you information. In fact, in vc++2010, it now uses msbuild 4.0 as build engine. and msbuild will automatically build referenced projects. That is what I do not want. However, after carefully investigation, I think I have find a solution: on command line, pass /p:BuildProjectReferences=false to msbuild, and this will cause msbuild to keep solving project references but not to build them.

 

Any way, thanks a lot for your help!


Thursday, July 15, 2010 3:36 AM

Hello, Jiang

You could exclude any project from building even they have dependencies. Right click your solution node, select “Properties”, and expand “Configuration Properties”, then click “Configuration”. You will find the grids contains all the project name, you could exclude it from building by unchecking the check box.

Thanks

Chao


Thursday, July 15, 2010 7:45 AM

Hello, Jiang

You could exclude any project from building even they have dependencies. Right click your solution node, select “Properties”, and expand “Configuration Properties”, then click “Configuration”. You will find the grids contains all the project name, you could exclude it from building by unchecking the check box.

Thanks

Chao

Thanks Chao. Maybe I was not making it clear enough. I am using msbuild to build a single project. Now, I want to use MSbuild to build A without building B. I want msbuild not to resolve project references when building projects. What I want to know is that, are there any command options or settings for msbuild to do this?

 

Regards

-Davie


Friday, July 16, 2010 1:35 AM

I find that in vs2010, if you are working with c++ projects, then there is an approach to achieve this. You need to use /t:BuildGenerateSources /t:BuildCompile /t:BuildLink to do a total build of a project, which will not trigger msbuild to resolve dependencies and build them. 

But for other projects, such as c#, vb.net, still no luck


Monday, July 19, 2010 3:20 AM

Hello, Davie
Sorry for the delay.

As far as I invested, there is no such option in MSBuild that could exclude the dependency project from building. The dependency information are stored in the solution file(*.sln). When you build the project in IDE, it will find the sln file, and get the dependency information.

I think if you really hate this behavior, you could build your project in command line. This will not make your solution file resolved.

Thanks

Chao