在 VSTS 上构建 wixproj

Build wixproj on VSTS

我正在尝试在 VSTS 上构建一个 wixproj,但到目前为止我只收到以下消息:

SetupProject1\SetupProject1.wixproj(27,5): Error : The WiX Toolset v3 build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/

为了我的测试,我在我的计算机上使用 Wix Toolset v3.11RC2 创建了一个新的 wixproj,并将其链接到 VSTS 上的一个新 repo。

VSTS 托管代理有 Wix 工具集 v3.10 installed.

VSTS 构建使用 VS 构建任务,构建平台设置为 x86 以避免 AnyCPU 错误。

我已尝试使用 Hosted 和 Hosted VS2017 代理,但没有成功,还尝试了默认的 Wix 导入:

<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />

以及为 VS2017 推荐的那些:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />

我需要配置什么还是目前无法配置?

您应该安装 WiX 工具集 v3.10v3.11项目模板需要相应的工具集版本(v3.11)。

所以,如果你想使用 v3.11,你需要设置一个 on premise build agent。顺便说一句,VS2017 需要 v3.11 工具集。

关于v3.10工具集,不要安装Wix Toolset Visual Studio 2015 extension,WiX v3.10扩展已经提供,直接安装Wix v3.10工具集即可。

如果您已经安装 Wix 工具集,v3.10 的简单步骤 Visual Studio 扩展:

  1. 删除 Wix 工具集 VS 扩展
  2. 卸载 WiX v3.10 工具集
  3. 安装 Wix v3.10 工具集
  4. 在 VS2015 中新建 Wix 项目
  5. 添加到源代码管理并构建。

类似问题:The WiX Toolset v3 build tools must be installed to build this project after applying template.

在@starain-MSFT 回答后总结我的研究:

可以在您的计算机上使用 VS2017 + Wix3.11,并使用 VS2015 + Wix3.10 在 VSTS 上构建,您只需:

  • 使用 Wix3.10 的模板:

    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    
     ...
    
    <Import Project="$(WixTargetsPath)" />
    
  • 避免任何 C# 7 specific

如果您被 ICE 警告阻止,属性 SuppressValidation 设置为 true 可能会有所帮助。

如果您的构建在 VSTS 上挂起,请检查计算机上的警告或将 .wixproj 中的 RunWixToolsOutOfProc 属性 设置为 true。