Dims
Dims

Reputation: 50999

Unable to specify project of solution for MSBuild

I have the following solution:

MySolution\
   MySolution.sln
   MyCSProject\
      MyCSProject.csproj
   MyCPPProject\
      VC11\
         projfile.vcxproj
      VC8
         projfile.vcproj
   MyInstallationProject
      MyInstallationPackage.vdproj

In Visual Studio I have MyCSProject set as main project. But for automated build I need to build MyInstallationProject with dependencies. MyInstallationProject depends on MyCSProject and MyCSProject depends on MyCPPProject. If I build from Visual Studio, it works.

But for MSBuild I can't compose correct command. Neither of the following worked:

"...\MSBuild.exe" MySolution.sln /t:MySolution\MyInstallationProject /p:Configuration="Release" /p:Platform="x64"

"...\MSBuild.exe" MySolution.sln /t:MySolution\MyInstallationProject.vdproj /p:Configuration="Release" /p:Platform="x64"

"...\MSBuild.exe" MySolution.sln /t:MyInstallationProject /p:Configuration="Release" /p:Platform="x64"

"...\MSBuild.exe" MyInstallationProject\MyInstallationProject.vdproj /p:Configuration="Release" /p:Platform="x64"

and so on, with various errors, mainly "The target *** does not exist in the project"

How to know correct command and or the name of target, associated with the project?

Upvotes: 0

Views: 187

Answers (1)

Mr Qian
Mr Qian

Reputation: 23740

In fact, one of the third and the fourth msbuild command line should have worked in your side. Also, there is a document about it.

The truth is that MSBuild cannot build the vdproj file. It is from VS installer project extension and the build tool is a separate tool from the extension rather than in the MSBuild. You can easily open the vdproj file and could find that it is not a xml style.

MSBuild can only build the xml sytle proj file.

To test it, you could try the same msbuild command line for MyCSProject project to get the difference.

So the right way is to use VS IDE build or use devenv build command line which means you have to you have VS IDE on your local.

Try the following command line:

1) open Developer Command Prompt for VS:

2) run:

cd xxx\xxx\MySolution
devenv MyInstallationProject\MyInstallationProject.vdproj /build

Upvotes: 1

Related Questions