admin管理员组

文章数量:1122832

I have been upgrading all our projects to target .NET framework 4.6.2 and I'm running into a maddening problem. When I run the application it runs fine. However, when I run the unit tests I get an assembly load failure:

=== Pre-bind state information ===
LOG: DisplayName = System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Source/FeatureBranch/Kernel/CDSCore.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Source\FeatureBranch\Kernel\CDSCore.Tests\bin\Debug\CDSCore.Tests.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: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Source/FeatureBranch/Kernel/CDSCore.Tests/bin/Debug/System.Runtime.CompilerServices.Unsafe.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Source\FeatureBranch\Kernel\CDSCore.Tests\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

So if I compare the two dlls (One in the CDSCore.Tests folder and another in a system dll dir CDSCore) See this:

They are the exact same file. However, if I open them in ildasm you see this which shows different assembly versions. How on earth is this the case?

本文标签: cSystemRuntimeCompilerServicesUnsafedll 61 has two different assembly versionsStack Overflow