简体   繁体   English

从 .net 4.0 升级到 4.6.1 后 WiX 工具集构建失败:无法加载 MSBuild 包装器?

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

So after upgrading my whole project to 4.6.1 I'm getting this error thrown by heat when I build it:因此,在将我的整个项目升级到 4.6.1 后,我在构建它时遇到了这个错误:

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.这里的问题是程序集绑定日志查看器没有显示任何内容,所以我不知道 WiX 在哪里搜索 MSBuild 版本 12,或者它是否确实存在并且还有另一个潜在问题。

I checked a lot of SO answers and googled a lot too, but I couldn't find anything problem like this one.我检查了很多 SO 答案,也搜索了很多,但我找不到像这样的问题。 Of course I tried them but nothing worked.当然,我尝试了它们,但没有任何效果。

Any ideas about this or why fuslogvw is showing nothing?关于这个或为什么 fuslogvw 什么都没有显示的任何想法? That would help me a lot这对我有很大帮助

Thanks a lot!非常感谢!

UPDATE: fuslogvw output:更新: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.

I don't know why fuslogvw is showing nothing, is it configured to log bind failures? 我不知道为什么fuslogvw什么也没显示,它是否配置为记录绑定失败?

WiX is using the standard way to load assemblies ( https://github.com/wixtoolset/wix3/blob/develop/src/ext/VSExtension/wixext/VSProjectHarvester.cs#L1119 ) WiX使用标准方式加载程序集( 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 ). 包装器直接引用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. 有关热量如何决定加载哪个版本的MSBuild的说明,请参见问题4853

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. 发生此错误的原因是HEAT正在查看.csproj文件的ToolsVersion并使用它来确定要加载的MSBuild.Tools程序集的版本。 Changing this from '12.0' (or what have you) to the version of MSBuild that you use fixes this issue. 将此从'12 .0'(或你有什么)更改为您使用的MSBuild版本可以解决此问题。

For older projects it can happen if a specific version of MSBuild tools is needed .对于较旧的项目,如果需要特定版本的 MSBuild 工具,则可能会发生这种情况。

Close Visual Studio, and关闭 Visual Studio,然后
Install Microsoft Build Tools 2013 (which is v12.0), or安装Microsoft Build Tools 2013 (v12.0),或
Install Microsoft Build Tools version shown in the Microsoft.Build error安装Microsoft.Build错误中显示的 Microsoft Build Tools 版本

My specific scenario我的具体情况

  • Visual Studio 2017 Enterprise (same in my VS 2022 Enterprise) Visual Studio 2017 Enterprise(在我的 VS 2022 Enterprise 中相同)
  • Build error Could not load file or assembly 'Microsoft.Build.Utilities.v12.0, Version=12.0.0.0...构建错误Could not load file or assembly 'Microsoft.Build.Utilities.v12.0, Version=12.0.0.0...
  • Had also downgraded to WIX Toolset 3.11.1 (Dec-2017) from 3.11.2 (Sep-2019), not sure if that was necessary还从 3.11.2(2019 年 9 月)降级到 WIX 工具集 3.11.1(2017 年 12 月),不确定是否有必要

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Visual Studio 2017中的.NET Framework从4.0升级到4.6.1后,C#API项目中发生错误 - ERROR in C# API project after upgrading .NET framework from 4.0 to 4.6.1 in Visual Studio 2017 将项目从.NET 3.5升级到.NET 4.6.1后出现svcutil错误 - svcutil error after upgrading projects from .NET 3.5 to .NET 4.6.1 从4.0升级到4.5后,MSBuild无法再找到依赖项? - MSBuild can no longer find dependencies after upgrading from 4.0 to 4.5? 从 .Net 4.6.1 升级到 .Net 4.8 后使用 System.IO.Compression 的问题 - Problems using System.IO.Compression after upgrading from .Net 4.6.1 to .Net 4.8 升级到.NET 4.6.1后缺少SignalR UseServiceBus定义 - SignalR UseServiceBus deinition missing after upgrading to .NET 4.6.1 如何在tfs上构建Wix Toolset 3.10安装程序 - How to build Wix Toolset 3.10 installer on tfs 从 .Net Framework 4.7 升级到 4.8 后使用 MSBuild 发布项目时出错 - Error in publishing project with MSBuild after upgrading from .Net Framework 4.7 to 4.8 必须安装 WiX Toolset v3.11(或更新版本)构建工具 - 即使在安装之后 - The WiX Toolset v3.11 (or newer) build tools must be installed - Even after installation WiX工具集:需要.NET 4.5的自定义操作 - WiX toolset: Custom Actions that require .NET 4.5 升级Unity版本后,项目无法构建 - Project fails to build after upgrading version of Unity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM