visual-studiovisual-c++msbuildsln-file

When do I need to pass MSBuild a solution file?


From the command line, when would I call MSBuild directly on a project, and when would I call MSBuild on the projec's sln file, passing /t:Build /t:ProjectName?

Example: I have a simple solution containing several projects (A, B, C, ...). Development is done through the VS GUI, by opening and working with the solution.

Now, in a specific automated case, I want to build just project B from the command line:

What should I call?:

(a) MSBuild "my.sln" "/t:Build" "/t:ProjB" "/p:Configuration=Release" "/p:Platform=Any CPU"

(b) MSBuild "ProjB.vcxproj" "/t:Build" "/p:Configuration=Release" "/p:Platform=Any CPU"


Solution

  • I can, so far, identify these issues: