2

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.

Community
  • 1
  • 1
Olaf Mandel
  • 787
  • 7
  • 20

2 Answers2

1

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.

Nicodemeus
  • 4,005
  • 20
  • 23
  • I can't find how to create binary references (are those possible for C++ as opposed to C# projects?). But I replaced my ProjectDependencies-references in the solution file with ProjectReference-references in the project files and tried the solution by jlew again. Still does not work: the referenced projects are all being build. – Olaf Mandel Jun 25 '13 at 07:59
1

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

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

AAATechGuy
  • 385
  • 2
  • 9