由于MSB4019

时间:2020-01-02 18:24:28

标签: msbuild wix travis-ci

我正在尝试使用travis在Windows环境中自动构建golang项目,并使用.exemsbuild来打包wix

与Github动作相同的配置,因此我认为.wixprojwxs都是正确的,并且在travis安装中msbuild的配置存在一些问题,但我没有更多线索。

可能是travis安装的msbuild不包括必需的wix工具集,我尝试安装它们,但是在创建软件包时错误仍然存​​在


错误

C:\Users\travis\gopath\src\github.com\gallo-cedrone\nri-elasticsearch\pkg\windows\nri-amd64-installer\nri-installer.wixproj" (default target) (1) ->
C:\Users\travis\gopath\src\github.com\gallo-cedrone\nri-elasticsearch\pkg\windows\nri-amd64-installer\nri-installer.wixproj(34,5): 
error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\WiX\v3.x\Wix.targets" was not found. 
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

.travis

...
  - os: windows
    env:
    - MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
    before_script:
    - powershell Install-WindowsFeature Net-Framework-Core
    - cinst -y wixtoolset
    script:
    - export PATH=$MSBUILD_PATH:$PATH
    - go test ./src/
    - go build -v -o ./target/bin/windows_amd64/nri-elasticsearch.exe  ./src/
    - msbuild.exe -version
    - cd ./pkg/windows/nri-amd64-installer/ ; pwd ; env ; msbuild.exe ./nri-installer.wixproj
...

travis job logs

1 个答案:

答案 0 :(得分:0)

感谢enter link description here

,我找到了解决方案

基本上,我正在安装wixtools,但是安装文件夹不是vs2017所期望的。

只需更改以下内容即可解决: [HttpPost] public async Task<bool> SaveContactRequest(ContactRequest request) { return await request.SaveRequest(); }

具有:

<Import Project="$(WixTargetsPath)" />

并删除<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') " /> 个clouses条件。