WiX toolset build fails after upgrading from .net 4.0 to 4.6.1: Cannot load MSBuild wrapper?

1

So after upgrading my whole project to 4.6.1 I'm getting this error thrown by heat when I build it:

Failed to load MSBuild wrapper object: Could not load file or assembly 'Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I also get

The command ""C:\Program Files (x86)\WiX Toolset v3.10\Bin\heat.exe" project "C:\Project\Project.csproj" -projectname "Project" -pog Binaries -gg -sfrag -nologo -out "obj\\Release\Harvested XML\_Project.xml"" exited with code 5316. 86  

The problem here is that the assembly binding log viewer is showing nothing, so I don't know where WiX is searching for the MSBuild version 12, or if it in fact exists and there's another underlying issue.

I checked a lot of SO answers and googled a lot too, but I couldn't find anything problem like this one. Of course I tried them but nothing worked.

Any ideas about this or why fuslogvw is showing nothing? That would help me a lot

Thanks a lot!

UPDATE: fuslogvw output:

*** Assembly Binder Log Entry  (28/04/2016 @ 12:28:06 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\WiX Toolset v3.10\Bin\heat.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/WiX Toolset v3.10/Bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = heat.exe
Calling assembly : WixVSExtension.MSBuild12, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\WiX Toolset v3.10\Bin\heat.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.10/Bin/Microsoft.Build.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.10/Bin/Microsoft.Build/Microsoft.Build.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.10/Bin/Microsoft.Build.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/WiX Toolset v3.10/Bin/Microsoft.Build/Microsoft.Build.EXE.
LOG: All probing URLs attempted and failed.
c#
visual-studio
msbuild
wix
asked on Stack Overflow Apr 28, 2016 by Gaspa79 • edited Apr 28, 2016 by Gaspa79

2 Answers

3

I don't know why fuslogvw is showing nothing, is it configured to log bind failures?

WiX is using the standard way to load assemblies (https://github.com/wixtoolset/wix3/blob/develop/src/ext/VSExtension/wixext/VSProjectHarvester.cs#L1119)

msbuildWrapperAssembly = Assembly.Load(String.Format(MSBuildWrapperAssemblyName, shortVersion, thisAssemblyName.Version, publicKeyToken));

The wrapper has a direct reference to Microsoft.Build (https://github.com/wixtoolset/wix3/blob/develop/src/ext/VSExtension/wixext/WixVSExtension.MSBuild12/WixVSExtension.MSBuild12.csproj#L23).

<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

See issue 4853 for an explanation of how heat decides which version of MSBuild to load.

answered on Stack Overflow Apr 28, 2016 by Sean Hall • edited Apr 28, 2016 by Sean Hall
0

This error can occur because HEAT is looking at the ToolsVersion of your .csproj file and using that to determine which version of the MSBuild.Tools assembly to load. Changing this from '12.0' (or what have you) to the version of MSBuild that you use fixes this issue.

answered on Stack Overflow Nov 20, 2018 by villecoder

User contributions licensed under CC BY-SA 3.0