我有一个Xamarin应用程序,针对Android SDK 30,每次我编译这个项目,我得到这个警告:
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 FilesMicrosoft Visual Studio2022CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv1.0System.Numerics.Vectors.dll].
C:Program FilesMicrosoft Visual Studio2022CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv1.0System.Numerics.Vectors.dll
Project file item includes which caused reference "C:Program FilesMicrosoft Visual Studio2022CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv1.0System.Numerics.Vectors.dll".
System.Numerics.Vectors
References which depend on "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
C:Usersitsve.nugetpackagessystem.text.json5.0.0libnetstandard2.0System.Text.Json.dll
Project file item includes which caused reference "C:Usersitsve.nugetpackagessystem.text.json5.0.0libnetstandard2.0System.Text.Json.dll".
C:Usersitsve.nugetpackagessystem.text.json5.0.0libnetstandard2.0System.Text.Json.dll
D:ReposMyAppMyApp.ServicesbinDebugnetstandard2.0MyApp.Services.dll
D:ReposMyAppMyAppbinDebugnetstandard2.0MyApp.dll
C:Usersitsve.nugetpackagesidentitymodel5.0.1libnetstandard2.0IdentityModel.dll
C:Usersitsve.nugetpackagesprism.plugin.logging.common8.0.11-betalibmonoandroid10.0Prism.Plugin.Logging.Common.dll
C:Usersitsve.nugetpackagesrefit5.2.4libnetstandard2.1Refit.dll
C:Usersitsve.nugetpackagesMyApp.auth.apiclient2021.9.27.1libnetstandard2.0MyApp.Auth.ApiClient.dll
C:Usersitsve.nugetpackagesMyApp.budgeting.apiclient2021.10.7.2libnetstandard2.0MyApp.Budgeting.ApiClient.dll MyApp.Android
项目既不引用System.Numerics.Vectors
,也不引用System.Numerics
。如何解决这个问题?我甚至不清楚是什么导致了这个问题。
更新:我将其注册为Xamarin的bug。表单- https://github.com/xamarin/Xamarin.Forms/issues/15046
在iOS和Android项目下,展开References,删除存在的System.Numerics
和System.Numerics.Vectors
引用。重新编译,错误就会消失。
这些引用(指向2.0.5.0版本)似乎是由VS Xamarin添加的。表单模板,它与新Nuget包引用的版本冲突。