How to use MSBuild to build a Visual Studio Setup Project

msbuild, visual-studio-2010

Solution

This works for me:

<Exec Command="&quot;$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com&quot; your.vdproj /build &quot;Debug|AnyCPU&quot;"/>

You don't need the space in any cpu and you need to call devenv.com, also assuming you have those build configuration existing?

Problem

I am trying to use MSBuild to build a Visual Studio Setup Project using the article below: http://msdn.microsoft.com/en-us/library/ms404859.aspx https://web.archive.org/web/20090218033835/msdn.microsoft.com/en-us/library/ms404859.aspx I have followed all the steps mentioned in the article above with the exception of not using TFS in this case. Instead of using the TFS option, I am trying to create a Demo.proj file and have included the below details: ** - Demo.proj** ``` <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="AfterCompile"> <Exec Command="&quot;$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv&quot; &quot;C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj&quot; /Build &quot;Debug|Any CPU&quot;"/> <Copy SourceFiles="C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\HelloWorldTestInstaller.msi; C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\setup.exe" DestinationFolder="$(OutDir)" /> </Target> </Project> ``` now when I trying to cmd prompt and trying the following command: msbuild DemoBuild.proj /target:AfterCompile I am getting the following error: Build FAILED. "C:\xxxxxxxxx\Documents\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj" (default target) (1) -> (AfterCompile target) -> C:\xxxxxxxxx\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj(4,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv" "C:\xxxxxxxxx\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj" /Build "Debug|Any CPU"" exited with code 1. ``` 0 Warning(s) 1 Error(s) ``` Time Elapsed 00:00:01.25 Can anyone help me to resolve this issue. Thanks & Regards, Santosh Kumar Patro

Original source

Related problems