tag:help.appveyor.com,2012-11-13:/discussions/problems/2673-could-not-load-file-or-assembly-error-when-calling-heat-wix-from-within-msbuildAppVeyor: Discussion 2018-08-25T01:58:29Ztag:help.appveyor.com,2012-11-13:Comment/375531242015-08-03T19:57:37Z2015-08-03T19:57:38Z'Could not load file or assembly' error when calling Heat (WiX) from within MSBuild<div><p>Adding some further information: after collecting Fusing binding
logs, it seems MSBuild is running as x64 (notice line below,
"Running under executable
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe",
pointing to Framework64 folder):</p>
<pre>
<code>*** Assembly Binder Log Entry (8/3/2015 @ 7:27:37 PM) ***
The operation failed.
Bind result: hr = 0x8007000b. An attempt was made to load a program with an incorrect format.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Program Files (x86)\WiX Toolset v3.9\bin\Heat.exe
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.9/bin/Heat.exe.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\WiX Toolset v3.9\bin\Heat.exe
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: heat, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b).
ERR: Run-from-source setup phase failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
*** Assembly Binder Log Entry (8/3/2015 @ 7:27:37 PM) ***
The operation failed.
Bind result: hr = 0x8007000b. An attempt was made to load a program with an incorrect format.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Program Files (x86)\WiX Toolset v3.9\bin\Heat.exe
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.9/bin/Heat.exe.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\WiX Toolset v3.9\bin\Heat.exe
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: heat, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b).
ERR: Run-from-source setup phase failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.</code>
</pre>
<p>How do I force MSBuild x86 to be used? I tried to set env var
Platform to x86, to no avail. After googling for a while, it seems
that invoking a x86 PowerShell would do the trick too, but I
couldn't find a way to instruct AppVeyor to use a x86
PowerShell.</p>
<p>Any ideas?</p></div>igoravltag:help.appveyor.com,2012-11-13:Comment/375531242015-08-03T22:04:35Z2015-08-03T22:04:35Z'Could not load file or assembly' error when calling Heat (WiX) from within MSBuild<div><p>Have you tried adding something like:</p>
<pre>
<code>set PATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;%PATH%</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/375531242015-08-03T23:03:38Z2015-08-03T23:03:38Z'Could not load file or assembly' error when calling Heat (WiX) from within MSBuild<div><p>Feodor, thanks for following up. I found a workaround, though I
don't quite understand whtá going on.</p>
<p>My wixproj file has these two imports:</p>
<pre>
<code><WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath></code>
</pre>
<p>For some reason it's resolving to #1, even though it's running
under MSBuild x64. By disabling the first line (thus forcing x64)
it now works.</p>
<p>Thanks for the help. If I eventually find anything else I'll
post it here for the record, in case others have the same
issue.</p>
<p>Cheers,<br>
Igor</p></div>igoravltag:help.appveyor.com,2012-11-13:Comment/375531242015-08-03T23:07:04Z2015-08-03T23:07:04Z'Could not load file or assembly' error when calling Heat (WiX) from within MSBuild<div><p>OK, thanks for the update!</p></div>Feodor Fitsner