【发布时间】:2020-07-05 10:19:49
【问题描述】:
我有两个项目,[Service] 和 [Web]。两者最初都是针对 .Net Framework 4.6 构建的。 [Web] 引用 [Service],并使用 [Service] 通过 NuGet 包安装的一些 DLL(特别是 System.Runtime.InteropServices.RuntimeInformation.dll 和 System.Net.Http.dll)。
[Web] 需要升级到目标 .Net Framework 4.7.2。这已经完成了,但是[Service] 中的这两个DLL 不再出现在[Web] 的bin/ 目录中。
我正在使用 Visual Studio 2017 Enterprise。
- 我已经确认,如果我将 [Web] 降级到 .Net Framework 4.6,DLL 会重新出现。但是,对于其他 DLL,[Web] 需要在 4.7.2 上,并且 [Service] 需要保持在 4.6 上。
-
System.Runtime.InteropServices.RuntimeInformation.dll来自Microsoft.AspNetCore.Mvc -
System.Net.Http来自自己的 Nuget 包
编辑:
我后来发现这深深地隐藏在构建的详细日志中:
Unified Dependency "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
29> Using this version instead of original version "4.0.1.0" in "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451\Microsoft.AspNetCore.Hosting.dll" because AutoUnify is 'true'.
29> Using this version instead of original version "4.0.1.0" in "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.server.kestrel\1.1.2\lib\net451\Microsoft.AspNetCore.Server.Kestrel.dll" because AutoUnify is 'true'.
29> Using this version instead of original version "4.0.1.0" in "C:\Users\baker\.nuget\packages\microsoft.extensions.logging.console\1.1.2\lib\net451\Microsoft.Extensions.Logging.Console.dll" because AutoUnify is 'true'.
29> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Runtime.InteropServices.RuntimeInformation.dll".
29> Reference found at search path location "{TargetFrameworkDirectory}".
29> For SearchPath "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451".
29> Considered "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451\System.Runtime.InteropServices.RuntimeInformation.winmd", but it didn't exist.
29> Considered "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451\System.Runtime.InteropServices.RuntimeInformation.dll", but it didn't exist.
29> Considered "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451\System.Runtime.InteropServices.RuntimeInformation.exe", but it didn't exist.
29> For SearchPath "{CandidateAssemblyFiles}".
29> Considered "net472Dlls\System.Net.Http.dll",
29> but its name "System.Net.Http"
29> didn't match the expected name "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
29> Considered "net472Dlls\System.Runtime.InteropServices.RuntimeInformation.dll",
29> but its name "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
29> didn't match the expected name "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
29> For SearchPath "{TargetFrameworkDirectory}".
29> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Runtime.InteropServices.RuntimeInformation.winmd", but it didn't exist.
29> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Runtime.InteropServices.RuntimeInformation.dll", but it didn't exist.
29> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Runtime.InteropServices.RuntimeInformation.exe", but it didn't exist.
29> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Runtime.InteropServices.RuntimeInformation.winmd", but it didn't exist.
29> Required by "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.hosting\1.1.2\lib\net451\Microsoft.AspNetCore.Hosting.dll".
29> Required by "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.server.kestrel\1.1.2\lib\net451\Microsoft.AspNetCore.Server.Kestrel.dll".
29> Required by "C:\Users\baker\.nuget\packages\microsoft.aspnetcore.server.kestrel.https\1.1.2\lib\net451\Microsoft.AspNetCore.Server.Kestrel.Https.dll".
29> Required by "C:\Users\baker\.nuget\packages\microsoft.extensions.logging.console\1.1.2\lib\net451\Microsoft.Extensions.Logging.Console.dll".
29> This reference is not "CopyLocal" because it conflicted with another reference with the same name and lost the conflict.
29> The ImageRuntimeVersion for this reference is "v4.0.30319".
【问题讨论】:
标签: c# .net asp.net-mvc visual-studio