在命令行上对.vdproj运行devenv不会产生MSI

问题描述:

我想在命令提示符下使用devenv命令从.vdproj文件生成MSI文件.该命令运行良好,但未生成MSI文件.怎么了?

I want to generate MSI files from a .vdproj file using the devenv command in a command prompt. This command is running well but no MSI file is generated. What is wrong?

我应该在环境变量中设置什么,或者还有其他方法可以从.vdproj文件生成MSI吗?

What should I set in environment variables, or is there any other way to generate an MSI from a .vdproj file?

(根据我的经验,这通常是由于未定位正确的构建配置而引起的).在Visual Studio中,在解决方案级别,您可以转到Build菜单并选择Configuration Manager.确保对于所有适用的配置(通过Active Solution Configuration下拉菜单选择),安装程序项目在Build列中均具有一个勾号.

This is usually (in my experience!) caused by not targeting the correct build configuration. Within Visual Studio, at the solution level you can go to the Build menu and choose Configuration Manager. Ensure that for all applicable configurations (chosen via the Active Solution Configuration drop-down) the installer project has a tick in the Build column.

现在,您需要确保在调用devenv时,您正在传递适当的构建配置(即,为安装项目打了Build的配置),如下所示:

Now you need to ensure that when invoking devenv you're passing the appropriate build configuration (i.e. one that has Build ticked for the setup project) as follows:

C:\PathToVisualStudio\devenv.exe /Rebuild Release C:\PathToProject\ProjectName.sln" /Out "PathToProject\vs_errors.txt"

(在此示例中,Release是我定位的构建配置)

(In this example, Release is the build configuration I'm targeting)

此命令还将Visual Studio的输出记录到与解决方案相同的文件夹中的名为vs_errors.txt的文本文件中,以便您可以检查以确定是否有其他原因导致安装项目无法生成.

This command also logs the output of Visual Studio to a text file called vs_errors.txt in the same folder as your solution so you can review this to determine if there are any other reasons why the setup project failed to build.