gpt4 book ai didi

.net - 两个引用程序集之间的冲突

转载 作者:行者123 更新时间:2023-12-04 15:19:24 25 4
gpt4 key购买 nike

我在玩 .Net Core运行良好的应用程序。然而,今天我发现output包含警告。将日志级别设置为 detailed 后我发现以下内容:

2>    Dependency "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
2> Could not resolve this reference. Could not locate the assembly "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2> For SearchPath "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5".
2> Considered "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.Extensions.DependencyModel.winmd", but it didn't exist.
2> Considered "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.Extensions.DependencyModel.dll", but it didn't exist.
2> Considered "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.Extensions.DependencyModel.exe", but it didn't exist.
2> For SearchPath "{CandidateAssemblyFiles}".
2> Considered "C:\Users\Alex\.nuget\packages\xunit.runner.visualstudio\2.2.0-beta4-build1194\build\netcoreapp1.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll",
2> but its name "xunit.runner.visualstudio.dotnetcore.testadapter"
2> didn't match the expected name "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
2> Considered "C:\Users\Alex\.nuget\packages\xunit.runner.visualstudio\2.2.0-beta4-build1194\build\netcoreapp1.0\xunit.runner.utility.dotnet.dll",
2> but its name "xunit.runner.utility.dotnet"
2> didn't match the expected name "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
2> Required by "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\testhost.dll".
2> Required by "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll".
2> There was a conflict between "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
2> "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not.
2> References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\Alex\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll].
2> C:\Users\Alex\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
2> Project file item includes which caused reference "C:\Users\Alex\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll".
2> C:\Users\Alex\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
2> References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
2> C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
2> Project file item includes which caused reference "C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll".
2> C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\testhost.dll
2> C:\Users\Alex\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20161123-03\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
2> C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1909,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
2> Done executing task "ResolveAssemblyReference".

线路 There was a conflict between "Microsoft.Extensions.DependencyModel... .我不知道如何解决这个警告,因为我只是在使用 .Net standard 1.1System.Reflection.Emit包裹来自 NuGet并且不要引用任何其他内容。

当然,我可以忽略这个警告,但寻找一些解决方案

最佳答案

根据详细的日志,我们发现依赖“Microsoft.Extensions.DependencyModel,Version=1.0.1.0,这是你的代码需要的。但是这个Version=1.0.0.0的依赖已经安装了。

所以当我们编译项目时,会选择Version=1.0.0.0的this依赖,会导致冲突。因此,您可以使用 NuGet 添加指定 version=1.0.1.0 的依赖项“Microsoft.Extensions.DependencyModel”来解决此警告问题。

关于.net - 两个引用程序集之间的冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41761733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com