Warnings on different vertion of nugget

Eduardo Gomez 3,651 Reputation points
2022-03-03T20:42:03.823+00:00

Hello

I have this warning on my app, and I do not know how to fix it, I don't even know where to begin

Found conflicts between different versions of "System.Numerics.Vectors" that could not be resolved.

There was a conflict between "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
"System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
References which depend on "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll].
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll
Project file item includes which caused reference "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll".
System.Numerics.Vectors
References which depend on "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
C:\Users\egome.nuget\packages\system.text.json\4.6.0\lib\netstandard2.0\System.Text.Json.dll
Project file item includes which caused reference "C:\Users\egome.nuget\packages\system.text.json\4.6.0\lib\netstandard2.0\System.Text.Json.dll".
C:\Users\egome.nuget\packages\system.text.json\4.6.0\lib\netstandard2.0\System.Text.Json.dll
C:\Users\egome.nuget\packages\azure.core\1.19.0\lib\netstandard2.0\Azure.Core.dll
C:\Users\egome\source\repos\DuoNotes\DuoNotes\bin\Debug\netstandard2.0\DuoNotes.dll
C:\Users\egome.nuget\packages\azure.storage.blobs\12.10.0\lib\netstandard2.0\Azure.Storage.Blobs.dll
C:\Users\egome.nuget\packages\azure.storage.common\12.9.0\lib\netstandard2.0\Azure.Storage.Common.dll
C:\Users\egome.nuget\packages\system.memory.data\1.0.2\lib\netstandard2.0\System.Memory.Data.dll DuoNotes.Android

Project

https://github.com/eduardoagr/DuoNotes/tree/Edu-Experimental

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2022-03-03T22:20:42.293+00:00

    That means that your project is referencing either NuGet packages or other projects and across the packages/projects multiple items are trying to use different versions of the assembly System.Numerics.Vectors. The compiler cannot figure out which one to use so it picked one. This is just a warning to let you know the compiler made a decision. However the build order determines which one actually gets dropped into your output directory and if it doesn't line up with what the compiler chose you get a runtime error.

    The correct solution to this is to add a binding redirect in your application's configuration file. Visual Studio can auto-generate this for you. Go to the Error List window and you should see this warning. It should tell you to double click the warning and it'll fix the problem for you. This should resolve the error. If you don't have that option for some reason then you can fix it manually by editing your configuration file instead but for now we'll assume this will work.

    Note that this is only an option if the warning is occurring within your executable project. If it is happening on a class library then the correct option is to add an explicit NuGet dependency on System.Numerics.Vectors within the project which will resolve the issue as well.

    Ultimately you'll want to make sure your packages and projects are using the latest version by using the Manage NuGet for Solution in Solution Explorer to make this easier.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.