我有一个天蓝色云项目和一个工人角色项目(+一些辅助项目)的解决方案。 当我在本地调试worker时,我得到了这个例外:
无法加载文件或程序集System.Runtime.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其中一个依赖项。定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)":" System.Runtime.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a
FusionLog:
=== Pre-bind state information ===
LOG: DisplayName = System.Runtime.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Azure/roles/[worker project]/approot
LOG: Initial PrivatePath = C:\Azure\roles\[worker project]\approot
Calling assembly : Microsoft.Extensions.Configuration, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Azure\roles\[worker project]\approot\[worker assembly].dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.0 redirected to 4.1.1.0.
LOG: Post-policy reference: System.Runtime.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/Azure/roles/[worker project]/approot/System.Runtime.Extensions.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
我在构建输出中看到的内容:
2> Task "Message"
2> CopyLocalDependencies=[solution]\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll
2> Task "Message"
2> CopyLocalDependencies=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Extensions.dll
...
2> Task "Message"
2> WorkerFiles=[solution]\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll -> System.Runtime.Extensions.dll
2> Task "Message"
2> WorkerFiles=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Extensions.dll -> System.Runtime.Extensions.dll
...
2> Copying file from "[solution]\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll" to "[solution]\[azure project]\obj\Debug\[worker project]\System.Runtime.Extensions.dll".
2> Copying file from "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Extensions.dll" to "[solution]\[azure project]\obj\Debug\[worker project]\System.Runtime.Extensions.dll".
为什么MSBuild将GAC的程序集复制到本地文件夹?如何改变这种行为?我没有直接引用GAC的System.Runtime.Extensions。 或者如何更改复制程序集的顺序?
我尝试了什么:
UPD 发现类似的问题
答案 0 :(得分:2)
这是一个MSBuild 14.0错误。 我发现了问题“ImplicitlyExpandDesignTimeFacades target should only add facades if a higher version isn't already referenced”。 解决方案是修改the target ImplicitlyExpandDesignTimeFacades。
我做了什么:
> <?xml version="1.0" encoding="utf-8"?> > <Project ToolsVersion="14.0" > DefaultTargets="Build" > xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> > .... > <Import Project="..\..\ImplicitlyExpandDesignTimeFacades.targets" /> > </Project>