Olaf Mandel
Olaf Mandel

Reputation: 827

How to ignore dependencies with msbuild

I have a Visual Studio solution (ab.sln) which references two (VC) project files a.proj and b.proj. The projects depend on each other (A is a postProject ProjectDependency of B). This dependency is needed when compiling under Visual Studio.

Now I want to compile only project B from the command line and I thought msbuild would be a good choice. But I want to compile the two projects separately in different folders (for CI). After compiling A, I want to copy the required files over to the working directory for the B compile.

How can I compile one project in the solution from the command line without building the dependencies (and without having an extra file)? My current command that builds the dependency is:

msbuild /t:b ab.sln

I could of course use a separate solution file b.sln that just contains project B, but I was trying to do without the extra file.

The answer given by jlew in How to get MSBuild to ignore project references? does not work for me, probably because I do not use ProjectReferences.

Upvotes: 2

Views: 1800

Answers (2)

AAATechGuy
AAATechGuy

Reputation: 385

https://stackoverflow.com/a/8127377/1578962

MSBuild myproj.csproj /p:Configuration=Debug /p:BuildProjectReferences=false /t:Build

Upvotes: 1

Nicodemeus
Nicodemeus

Reputation: 4083

If both projects used the same $(OutDir) and project B made a binary reference rather than a project reference to A in the shared $(OutDir), then it should work.

Upvotes: 1

Related Questions