When I build my asp.net core 2.2 app, I get a warning saying
There was a conflict between "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
"Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not.
References which depend on "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.server.abstractions/2.0.0/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll].
/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.server.abstractions/2.0.0/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
Project file item includes which caused reference "/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.server.abstractions/2.0.0/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll".
/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.server.abstractions/2.0.0/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
References which depend on "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.abstractions/2.0.3/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Abstractions.dll
Project file item includes which caused reference "/Users/yurypastushenko/.nuget/packages/microsoft.aspnetcore.hosting.abstractions/2.0.3/lib/netstandard2.0/Microsoft.AspNetCore.Hosting.Abstractions.dll".
Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Notice the empty list [] after References which depend on "Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
Does this mean that I have no references to version 2.0.3? Then why is this reference conflict happens?
Did anyone meet a similar problem?
Pavel, thank you for your comment. While trying to answer, I came across the two references in .csproj files:
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<HintPath>..\..\..\.nuget\packages\microsoft.aspnetcore.hosting.abstractions\2.0.3\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<HintPath>..\..\..\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
I have no idea how did they get there, but obviously they are the reason of the conflicts. After deleting them everything compiles without warnings.
Related
I have a netstandard2.0 library that is used by net5.0 applications
One of packages used by the library references Microsoft.Bcl.AsyncInterfaces 5.0.0
But I get this warning for every application:
47>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5):
warning MSB3277: Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved.
There was a conflict between "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
"Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was not.
References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll].
C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll
Project file item includes which caused reference "C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll".
C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll
References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [].
Please note that "Project file item includes which caused reference" is not a project but the dll itself. My guess is that 1.0.0 version is used by compiler with .net standard to provide some core async functionality
But how can I get rid of this message? There seems to be no binding redirection for .Net 5.0
I am using Bridge.net v17.10.1, and according to the documentation they are implemented in Bridge.Core.
HashSet<T> varName;
Stack<T> varName2;
Produces the following errors:
Error CS0433 The type 'HashSet<T>' exists in both 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'Bridge, Version=17.6.0.0, Culture=neutral, PublicKeyToken=null'
Error CS0433 The type 'Stack<T>' exists in both 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'Bridge, Version=17.6.0.0, Culture=neutral, PublicKeyToken=null'
Probably something super simple, but my Bridge.Net knowledge is limited and I have not been able to figure it out.
This is a known issue, the answer is described here: https://forums.bridge.net/forum/community/help/2902-c-compile-error-the-type-stopwatch-exists-in-both-system-and-bridge
Yes, you have to remove System reference from your csproj file
Also I can suggest to add the following reference to prevent adding System reference by Visual Studio
<Reference Include="System" Condition="False" />
Getting the following error when attempting to build my solution. I'm fairly certain I've done it on this machine before but it's been many months. I'm not sure what might have changed in the meantime.
Assembly uses 'Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' which has a higher version than referenced assembly 'Microsoft.AnalysisServices.AdomdClient' with identity 'Microsoft.AnalysisServices.AdomdClient, Version=8.0.700.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
I have attempted to remove every mention of 8.0.700.0 from my computer via the SSDT (un)installer and manual deletion of files and registry entries and gacutil. The project is configured to use 10.0, but I cannot figure out how it even knows that a 8.0.700.0 version exists in the first place.
As far as I know, nothing remains in the registry, or the GAC, or the assemblies folders for version 8.0.700.0.
Any idea what is going on here?
Currently in the GAC
$ gacutil /l | grep Microsoft.AnalysisServices.AdomdClient,
Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
I have the following warning messages during build.
No way to resolve conflict between "System.ComponentModel.Annotations,
Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and
"System.ComponentModel.Annotations, Version=4.0.10.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a". Choosing
"System.ComponentModel.Annotations, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
We have around 70 C# projects (net framework 462, net core, net standard). Are there any automated tools to fix the version conflicts problem?
I'm developing a C# library project with .NET Framework 4.6.2 and log4net 2.0.8.
When I try to compile the project I get the following error:
error CS0433: The type 'log4net.ILog' exists in
'c:\Windows\assembly\GAC_32\log4net\1.2.10.0__692fbea5521e1304\log4net.dll'
and also in
'd:\Desarrollo\packages\log4net.2.0.8\lib\net45-full\log4net.dll'
It seems that there is another version of log4net in GAC.
Why does it use the GAC version to compile? I have another projects with log4net and only in this one I get this error.
The reference for log4net is D:\Desarrollo\packages\log4net.2.0.8\lib\net45-full\log4net.dll. And it sets as local copy.
I have installed the package and added again with the same error.
The detailed error is this:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3243: No way to resolve conflict between "log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" and "log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304". Choosing "log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" arbitrarily.
1>D:\MyProject\Loggers\ActionLogHelper.cs(28,20,28,24): error CS0433: The type 'ILog' exists in both 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' and 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'
1>D:\MyProject\Loggers\ActionLogHelper.cs(30,26,30,30): error CS0433: The type 'ILog' exists in both 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' and 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'
1>D:\MyProject\Loggers\ExceptionLogHelper.cs(22,20,22,24): error CS0433: The type 'ILog' exists in both 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' and 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'
1>D:\MyProject\Loggers\ExceptionLogHelper.cs(24,29,24,33): error CS0433: The type 'ILog' exists in both 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' and 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The problem was that there were two references to the same dll in the project file. I have opened the project file with Notepad++ and I have found this inside:
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="log4net">
<HintPath>..\..\..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
</Reference>
I have removed the last one, and now it compiles.