How can I fix microsoft code analysis package compatibility issue? - visual-studio

I'm receiving these 4 distressing errors:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.CodeAnalysis.Common 1.3.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.CodeAnalysis.Common 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.CodeAnalysis.CSharp 1.3.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.CodeAnalysis.CSharp 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.CodeAnalysis.Common 1.3.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.CodeAnalysis.Common 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.CodeAnalysis.CSharp 1.3.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.CodeAnalysis.CSharp 1.3.0 supports: portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
It didn't show up back in the past but after a few repairs/modifications/reinstalls of Visual Studio it now shows up. I need to make an MVC in core 1.1 and I just want to get rid of these errors. Why am I getting these errors?

You can find the Microsoft documentation for this error here.
This error is commonly caused by a NuGet package not supporting the project's target framework. Check your referenced packages and make sure that they support your target framework, and try removing and re-adding them to find out which one(s) are causing the errors.
You can also try the method in this answer, where they recommend running the following command:
dotnet nuget locals all --clear

Related

Visual Studio won't accept UWP version for Nugget package?

This is driving me nuts!
I'm trying to install Microsoft.Build. Using Nugget Manager I can successfully install Microsoft.Build.Framework but not Microsoft.Build. I've upgraded to the latest version 1903 (build 18362), but still get the error:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.Build 16.5.0 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x64. Package Microsoft.Build 16.5.0 supports:
- net472 (.NETFramework,Version=v4.7.2)
- netcoreapp2.1 (.NETCoreApp,Version=v2.1)
But the framework requirements for both are the same? Anyone seen this or have some idea what the problem is?
thanks
The reason for your issue is that: Microsoft.Build Nugget package does not support UWP project. So you can't install the Nuget package in UWP projects.

How to set xamarin forms project to mono android

I am trying out Telerik UI for Xamarin forms for the first time and while going through the documentation, one of the required android support library is Xamarin.Android.Support.Vector.Drawable(v28.0). I tried downloading the package from nuget and I get an error.
This is the error:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Xamarin.Android.Support.Vector.Drawable 28.0.0.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Xamarin.Android.Support.Vector.Drawable 28.0.0.1 supports:
- monoandroid60 (MonoAndroid,Version=v6.0)
- monoandroid70 (MonoAndroid,Version=v7.0)
- monoandroid71 (MonoAndroid,Version=v7.1)
- monoandroid80 (MonoAndroid,Version=v8.0)
- monoandroid81 (MonoAndroid,Version=v8.1)
- monoandroid90 (MonoAndroid,Version=v9.0) UITest C:\Users\FAITH\source\repos\UITest\UITest\UITest\UITest.csproj 1
I have looked up several solutions online and nothing works. I have also tried to change project target framework version and all I see is .NETStandard as the highest.
We should install the Xamarin.Android.Support.Vector.Drawable Nuget in xamarin android project.When we select the Nuget as follows , there is no such problem.

How to fix Error NU1202 Package Xamarin.Android.Support.CustomTabs

I'm building a Xamarin App!
When I install Xamarin.Android.Support.CustomTabs Nuget package it shows me this error and no other nuget package is updating even !
I tried everything searched on google but still I've no idea what to do with this error
Error:
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'Detail' does not exist in the current
context DummyApp C:\Users\hashir.malik\source\repos\DummyApp\DummyApp\DummyApp\MainPage.xaml.cs 29 Active
Error NU1202 Package Xamarin.Android.Support.CustomTabs 27.0.2 is not
compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package
Xamarin.Android.Support.CustomTabs 27.0.2 supports: monoandroid81
(MonoAndroid,Version=v8.1) DummyApp C:\Users\hashir.malik\source\repos\DummyApp\DummyApp\DummyApp\DummyApp.csproj 1
ScreenShot : https://i.stack.imgur.com/DaLBj.png
You're trying to install the package to the shared project which is .Net Standard 2.0.
The Packages only need to be installed to the Android project. So uncheck "DummyApp" and only check "DummyApp.Android" in NuGet UI.

Unable to install nuget packages in xamarin android project

I am facing a very strange issue regarding installing NuGet packages in the xamarin android project. When I try to install any NuGet package in xamarin android project getting an error.
Here is the error message I am getting from the NuGet package manager.
?Restoring packages for E:\Projects\Sample\Sample1\Sample2\Smaple3\SampleApp.Android\SampleApp.Android.csproj...
NU1202: Package Microsoft.WindowsAPICodePack.Shell 1.1.0 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Microsoft.WindowsAPICodePack.Shell 1.1.0 supports: net (.NETFramework,Version=v0.0)
NU1202: Package Microsoft.WindowsAPICodePack.Core 1.1.0 is not compatible with monoandroid81 (MonoAndroid,Version=v8.1). Package Microsoft.WindowsAPICodePack.Core 1.1.0 supports: net (.NETFramework,Version=v0.0)
Package restore failed. Rolling back package changes for 'SampleApp.Android'.
Time Elapsed: 00:00:01.9192186
========== Finished ==========
Installed packages in the Android project:
Remove Microsoft.WindowsAPICodePack from your PCL, since you are having a reference of it in the PCL and then your Android project refers the PCL that works like an indirect reference hence it is causing the issue.
Solution: remove the package from PCL project

target 'MonoAndroid,Version=v6.0' project dependencies

My Visual studio 2017 nuget package can't install following error is occured in Xamarin.Forms Portable class library Project
Severity Code Description Project File Line Suppression State
Error Could not install package 'Xamarin.Android.Support.Compat 25.3.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0
Xamarin.Android.Support.Compat version 25.3.1 has dependencies of
MonoAndroid 7.0
Xamarin.Android.Support.Annotations (= 25.3.1)
Xamarin.Build.Download (>= 0.4.3)
Re: https://www.nuget.org/packages/Xamarin.Android.Support.Compat/25.3.1
You need to set the Target Framework to at least 7.0.
Re: https://developer.xamarin.com/guides/android/application_fundamentals/understanding_android_api_levels/#Target_Framework

Resources