微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

即使使用--no-build标志,在运行dotnet测试时如何避免Wix构建错误?

如何解决即使使用--no-build标志,在运行dotnet测试时如何避免Wix构建错误?

即使使用--no-build标志,在运行dotnet测试时如何避免Windows Installer Wix构建? 即使安装了Wix工具,它仍然会失败。

命令行

dotnet.exe test --configuration Release --no-build

错误

.msi.wixproj: error : The WiX Toolset v3.11 (or newer) build tools must be installed to build this project.

解决方法

这是解决该问题的方法,请使用标志通过使用MSBuild保留关键字MSBuildRuntimeType跳过将WixTools导入到项目中。

您必须按如下所示修改.wixproj文件,并添加空的VSTest目标。

<Target Name="VSTest" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition="'$(MSBuildRuntimeType)' != 'Core' AND '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets')" />
<Target Name="EnsureWixToolsetInstalled" Condition="'$(MSBuildRuntimeType)' != 'Core' AND '$(WixTargetsImported)' != 'true'">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset,see http://wixtoolset.org/releases/" />
</Target>

然后您可以使用以下命令行运行测试

dotnet test -v n --no-build

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。