(Wix) heat.exe 无法用 msbuild 加载

Seb*_*ian 12 msbuild windows-installer wix heat visual-studio

heat.exe当我用 . 构建我的项目时,我遇到了一个问题MSBuild。我收到此错误消息:

未处理的异常:System.BadImageFormatException:无法加载文件或程序集“file:///C:\Program Files (x86)\WiX Toolset v3.11\bin\Heat.exe”或其依赖项之一。尝试加载格式不正确的程序。

我在这里查找了 stackoverflow 上可能的解决方案: 参考链接

我尝试以各种方式更改我的配置,但无法掌握缺少的内容。

这就是我现在的配置方式。我希望能够同时针对 x64 和 x86 平台。

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>..\..\BuildArtifacts\SetupProjects\Myproject</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>..\..\BuildArtifacts\SetupProjects\Myproject</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Release</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\..\BuildArtifacts\SetupProjects\Myproject</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\BuildArtifacts\SetupProjects\Myproject</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Release</DefineConstants>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏,

kuc*_*h3n 32

由于 msbuild 作为 64 位 exe 运行,因此将无法加载 32 位 heat.exe。要解决此问题,进程必须单独运行。这可以通过将其添加到 PropertyGroup 来完成:

<RunWixToolsOutOfProc Condition=" '$(PROCESSOR_ARCHITECTURE)'!='x86' ">true</RunWixToolsOutOfProc>
Run Code Online (Sandbox Code Playgroud)

但这还不够。Heat 确实成功地忽略了该属性。相反,您必须使用该属性RunAsSeparateProcess

<HeatDirectory
        ....
    RunAsSeparateProcess="$(RunWixToolsOutOfProc)" />
Run Code Online (Sandbox Code Playgroud)

请参阅: https ://github.com/wixtoolset/issues/issues/2467#issuecomment-736519622


Ste*_*mul 3

更新:WiX 的问题数据库中似乎有一个已关闭的问题,您应该首先检查一下。请检查问题描述是否与您遇到的情况相符https://github.com/wixtoolset/issues/issues/2467

它似乎与64 位 MSBuild有关- 并且异常与您所描述的相同。也许从下往上阅读评论 - 底部有一条 2017 年的最新评论。

我天真的第一个想法是你是否可以运行 32 位 MSBuild?(我对此了解不多)。或者如链接问题的底部评论中所述,将可执行文件作为外部进程运行?


旧答案:首先想到的是:我相信heat.exe64 位 COM 文件存在问题。您的项目中有这些吗?只是提一下,可能还有另一个原因(也)。如果可能的话,也许可以尝试通过删除 COM 文件并运行构建来进行测试。

我相信这个问题仍然存在。我对此了解不多,但我获悉 FireGiant 的商业套件(换句话说不是免费的)可以处理 64 位文件的高级采集。