簡體   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?

因此,在將我的整個項目升級到 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.

我也得到

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  

這里的問題是程序集綁定日志查看器沒有顯示任何內容,所以我不知道 WiX 在哪里搜索 MSBuild 版本 12,或者它是否確實存在並且還有另一個潛在問題。

我檢查了很多 SO 答案,也搜索了很多,但我找不到像這樣的問題。 當然,我嘗試了它們,但沒有任何效果。

關於這個或為什么 fuslogvw 什么都沒有顯示的任何想法? 這對我有很大幫助

非常感謝!

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

我不知道為什么fuslogvw什么也沒顯示,它是否配置為記錄綁定失敗?

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));

包裝器直接引用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" />

有關熱量如何決定加載哪個版本的MSBuild的說明,請參見問題4853

發生此錯誤的原因是HEAT正在查看.csproj文件的ToolsVersion並使用它來確定要加載的MSBuild.Tools程序集的版本。 將此從'12 .0'(或你有什么)更改為您使用的MSBuild版本可以解決此問題。

對於較舊的項目,如果需要特定版本的 MSBuild 工具,則可能會發生這種情況。

關閉 Visual Studio,然后
安裝Microsoft Build Tools 2013 (v12.0),或
安裝Microsoft.Build錯誤中顯示的 Microsoft Build Tools 版本

我的具體情況

  • Visual Studio 2017 Enterprise(在我的 VS 2022 Enterprise 中相同)
  • 構建錯誤Could not load file or assembly 'Microsoft.Build.Utilities.v12.0, Version=12.0.0.0...
  • 還從 3.11.2(2019 年 9 月)降級到 WIX 工具集 3.11.1(2017 年 12 月),不確定是否有必要

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM