How to use MSBuild to build a Visual Studio Setup Project

佐手、 提交于 2019-12-22 04:35:34

问题


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

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


回答1:


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?




回答2:


James' answer helped me but I still got an error stating An error occurred while validating.

I had to also do this and finally got it working. For VS2015, add the registry key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild and set the value to 0.



来源:https://stackoverflow.com/questions/18512015/how-to-use-msbuild-to-build-a-visual-studio-setup-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!