当我在heat.exe中构建我的项目时,我对MSBuild有一个问题。我收到以下错误消息:
未处理的异常:无法加载文件或程序集“file:///C:\Program文件(x86)\WiX v3.11\bin\Heat.exe”或其依赖项之一。试图加载格式不正确的程序。
我在这里找到了一个关于堆栈溢出的可能的解决方案:Referred links
我尝试过以各种方式改变我的配置,但无法掌握缺少的内容。
我现在就是这样配置的。我希望能够同时瞄准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>任何帮助都很感激,
发布于 2018-04-23 17:11:30
更新:在WiX的问题数据库中似乎有一个封闭的问题,您首先应该查看它。请检查问题描述是否让人想起您所经历的:https://github.com/wixtoolset/issues/issues/2467
它似乎与64位MSBuild有关,而且例外情况与您所描述的相同。也许可以自下而上地阅读评论--从2017年开始,底部就有一条评论。
我天真的第一个想法是,您是否可以运行32位MSBuild呢?(我对此不太了解)。或者,如链接问题中的底部注释所述,将可执行文件作为外部进程运行?
旧答案:我想到的第一件事是:我相信heat.exe在64位COM文件上有问题。你的项目里有那些吗?仅仅提到这一点,可能还有另外一个原因。如果可能,可以尝试通过删除COM文件并运行构建来进行测试。
我相信这个问题仍然存在。我不太了解它,但我被告知,FireGiant的商业工具包(换句话说,不是免费的)处理64位文件的高级收获。
发布于 2020-12-01 12:31:34
由于msbuild作为64位exe运行,因此它将无法加载32位heat.exe。要解决此问题,进程必须单独运行。这可以通过将其添加到PropertyGroup中来实现:
<RunWixToolsOutOfProc Condition=" '$(PROCESSOR_ARCHITECTURE)'!='x86' ">true</RunWixToolsOutOfProc>但这还不够。热量确实成功地忽略了这一特性。相反,您必须使用属性RunAsSeparateProcess
<HeatDirectory
....
RunAsSeparateProcess="$(RunWixToolsOutOfProc)" />请参阅:https://github.com/wixtoolset/issues/issues/2467#issuecomment-736519622
发布于 2020-02-06 13:20:39
通过将wixproj更改为
<Target Name="BeforeBuild">
<HeatDirectory Directory="$(MSBuildThisFileDirectory)lib\" PreprocessorVariable="var.HarvestPath" OutputFile=".\clients\sftp\OmsFileServer\SFTPFileServerInstaller\SFTPFileServerInstaller\HeatGeneratedFileList.wxs" ComponentGroupName="HeatGenerated" DirectoryRefId="INSTALLFOLDER" AutogenerateGuids="true" ToolPath="$(WixToolPath)" SuppressUniqueIds="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true"/>
</Target>至
<PropertyGroup>
<InstallerPlatform>x64</InstallerPlatform>
<Platform>x64</Platform>
</PropertyGroup>
<Target Name="BeforeBuild">
<Exec Command='"$(WIX)bin\heat.exe" dir "$(MSBuildThisFileDirectory)lib" -cg HeatGenerated -dr INSTALLFOLDER -sreg -srd -var var.HarvestPath -ag -sfrag -suid -out "$(MSBuildThisFileDirectory)HeatGeneratedFileList.wxs"'/>
</Target>我意识到,因为我的蛋糕脚本要求MSBuild-x64构建解决方案,它不知何故不能运行32位HeatDirectory命令,但我不知道Exec在x64管道中到底是如何工作的,HeatDirectory不知道。
此外,64位应用程序肯定可以执行32位应用程序,它不可能只有另一种方式。但互联网上的其他东西对我没有用。
https://stackoverflow.com/questions/49981194
复制相似问题