Running devenv against a .vdproj at the command li

2020-07-13 02:36发布

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?

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

4条回答
爷、活的狠高调
2楼-- · 2020-07-13 03:20

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.

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"

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

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.

查看更多
趁早两清
3楼-- · 2020-07-13 03:24

Above script worked for me, try it and let me know if it works for you. You can pretty much have any configuration. I have used Release|x86. Just replace that line with your configuration and it should work. Make sure that whatever configuration you use exists in .sln file or .csproj file, otherwise you may get some error about invalid configuration. Hope this helps.

<target name="BuildMsi">
    <echo message="Creating installables (.msi) for MyTestApplication, please wait..."/>    
    <exec program="c:\program files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe">
        <arg value="c:\My app\My_Test_solution.sln"/>
        <arg value="/build"/>
        <arg value="Release|x86" />
        <arg value="/project"/>
        <arg value="c:\My app\setup\My_Test_solution.vdproj"/>
    </exec>
</target>
查看更多
做自己的国王
4楼-- · 2020-07-13 03:33

My case was the same, and giving the project name with /project helped with .msi file generation,

devenv /build Release /project SDK-Deployment SDK-Deployment.vdproj
查看更多
我只想做你的唯一
5楼-- · 2020-07-13 03:34

I don't think that msi will be genereated from devenv.com , you may choose wix with nant to create installer.

Nant has a task, msi task but it requires micrsoft cabinet sdk, which is not available for download.

read this for more details Build merge module without Devenv from .vdproj

p.s. If you find another way to build the installer , please share.

查看更多
登录 后发表回答