如何在 Azure Devops 中使用 WIX 创建 .msi 安装程序?

问题描述 投票:0回答:2

我正在尝试使用 yaml 脚本为 azure devops 中的桌面应用程序创建一个带有 wix 的 .msi 安装程序包。下面是为此创建的 msbuild 任务:

- task: MSBuild@1
  inputs:
    solution: '**/*.wixproj'
#    platform: 'Any CPU'
    configuration: 'Release'
    msbuildArguments: '/p:Configuration=Release/p:ProductCode=${product_code} /p:UpgradeCode=${upgrade_code}/t:Clean;Rebuild'
    clean: true

下面是我在管道构建过程中遇到的错误:

 Error MSB3441: Cannot get assembly name for "..\MyProject\bin\Release\MyProject.exe". Could not load file or assembly 'MyProject.exe' or one of its dependencies. The system cannot find the path specified.

提前致谢。

azure-devops msbuild wix windows-installer azure-yaml-pipelines
2个回答
2
投票

我们也遇到过这个问题。我们的解决方案是从解决方案文件中删除安装程序项目,使用标准

MSBuild
任务继续构建解决方案中的其他项目,然后将
script
任务添加到管道中以生成 MSI:

pool:
  vmImage: windows-latest

steps:
    - script: .\Tools\Wix\candle.exe -nologo Foobar.wxs -out Foobar.wixobj -ext WixUIExtension
      displayName: 'Compile Wix file'
    
    - script: .\Tools\Wix\light.exe -nologo Foobar.wixobj -out Foobar.msi -ext WixUIExtension
      displayName: 'Create MSI file'

请注意,我们的构建基于

windows-latest
映像,其中包括 WiX 工具集;请参阅此处的所有包含工具的列表。


1
投票

我没有自定义参数,所以也许这就是这里的区别,但我使用了 Azure Pipelines 为您提供的模板化 msbuild 任务。它生成了下面的 yaml,并在管道中很好地构建了 msi。

- task: MSBuild@1
  inputs:
    solution: '**/*.wixproj'
    msbuildArchitecture: 'x64'
    platform: 'x64'
    configuration: 'Release'
  displayName: 'build installer'
© www.soinside.com 2019 - 2024. All rights reserved.