【发布时间】:2021-04-15 17:04:22
【问题描述】:
我有一个包含两个项目的 Visual Studio 解决方案; MyProject 和 MyProject.Installer 后者是 Wix 工具集项目。我确实不从 Wix 项目中引用 MyProject,因为我不想要典型的构建输出,而是想要独立的二进制文件(请参阅管道)。
我做一个 dotnet 发布并将我想要的文件输出到 \client 相对于 MyProject.Installer wix 项目。在 Product.wxs 文件中,我引用了这些文件:
<Component Id="MyProject.exe" Guid="b1211231-2e88-4679-b2d3-879e8a3f9353">
<File Id="MyProject.exe" Source="client\MyProject.exe" KeyPath="yes" />
</Component>
我的 Azure DevOps 管道如下:
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/MyProject.csproj'
arguments: '--output $(Build.ArtifactStagingDirectory)\client --configuration $(BuildConfiguration) --runtime win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true'
zipAfterPublish: false
modifyOutputPath: false
- task: MSBuild@1
inputs:
solution: '**/*.wixproj'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/p:RunWixToolsOutOfProc=true'
- task: PublishBuildArtifacts@1
displayName: 'Save artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
管道运行的输出(成功):
"C:\Program Files\dotnet\dotnet.exe" publish D:\a\1\s\MyProject\MyProject.csproj --output D:\a\1\a\client --configuration Release --runtime win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true
WIX(不成功):
C:\Program Files (x86)\WiX Toolset v3.11\bin\Light.exe -out D:\a\1\s\MyProject.Installer\bin\Release\nb-NO\MyProject.Installer.msi -pdbout D:\a\1\s\MyProject.Installer\bin\Release\nb-NO\MyProject.Installer.wixpdb -cultures:nb-NO -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" -loc Product.nb-NO.wxl -contentsfile obj\Release\MyProject.Installer.wixproj.BindContentsFileListnb-NO.txt -outputsfile obj\Release\MyProject.Installer.wixproj.BindOutputsFileListnb-NO.txt -builtoutputsfile obj\Release\MyProject.Installer.wixproj.BindBuiltOutputsFileListnb-NO.txt -wixprojectfile D:\a\1\s\MyProject.Installer\MyProject.Installer.wixproj obj\Release\Product.wixobj
##[error]MyProject.Installer\Product.wxs(108,0): Error LGHT0103: The system cannot find the file 'client\MyProject.exe'.
很明显,它找不到要嵌入 MSI 的文件,但我不知道如何继续。
非常感谢任何关于如何组织项目、输出和配置管道的建议。
【问题讨论】:
标签: c# azure-devops wix windows-installer