core icon indicating copy to clipboard operation
core copied to clipboard

Package Microsoft.AspNetCore.All 2.1.0 is not compatible with netcoreapp2.0

Open IndigoHealth opened this issue 8 years ago • 15 comments

Package Microsoft.AspNetCore.All 2.1.0 is not compatible with netcoreapp2.0

General

I have VS 2017, version 15.7.3. NuGet is version 4.6.0. If I create a new ASP.Net Core app (either an API or a Web App), the template gives me Microsoft.AspNetCore.All v2.0.8. In either project, on either of two computers (with identical VS versions), when I ask NuGet to upgrade Microsoft.AspNetCore.All to 2.1.0, it says:

Package restore failed. Rolling back package changes for 'MyProject'. Package Microsoft.AspNetCore.All 2.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.AspNetCore.All 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1)

Since I see this on two different computers, I would think it should be pretty easily reproduced.

IndigoHealth avatar Jun 09 '18 04:06 IndigoHealth

The Microsoft.AspNetCore.All meta package is 159 dlls and uses the local runtime cache (which is installed with 2.1) so I believe this is intentional.

OTOH you should be able to use the individual packages directly on netcoreapp2.0 and net47x as they are netstandard2.0

benaadams avatar Jun 09 '18 04:06 benaadams

Thank you so much for the quick reply!

Uh.... can you translate that to "here's what you need to do to fix it"? The meta package is, presumably, the preferred way for customers like me to get all of the Asp.Net Core goodness. I don't understand how "you can't upgrade to the newer version" can be intentional behavior.

Is there a workaround that involves, for example, uninstalling the meta package and then installing a newer version of the meta package?

IndigoHealth avatar Jun 09 '18 05:06 IndigoHealth

Install the new version of the SDK? https://www.microsoft.com/net/download/ .NET Core 2.1 SDK v2.1.300

That should also update the templates for any new projects you create.

For existing projects (upgarde) in their .csproj files change

<TargetFramework>netcoreapp2.0</TargetFramework>

To

<TargetFramework>netcoreapp2.1</TargetFramework>

More detailed instructions are provided here: https://docs.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1

HTH

benaadams avatar Jun 09 '18 10:06 benaadams

Aha! Yes, I had installed the updated SDK, but it never occurred to me to try to create a fresh, new project from the templates. That does, indeed, create a core 2.1 project.

And, FYI, I had previously posted this same question as a reply to a different GitHub issue dealing with this same problem. I got a reply saying that this would probably be fixed in the next VS release.

Life is good. Thank you!

IndigoHealth avatar Jun 09 '18 15:06 IndigoHealth

Thanks, downloading NET Core 2.1 SDK v2.1.300 helped after some struggle . I just hope i did the right thing using the new Core stuff...

dman103 avatar Jun 10 '18 18:06 dman103

Worked for me, thank you!

Sauedy avatar Jun 12 '18 04:06 Sauedy

Worked for me Thanks

mo-norant avatar Jul 12 '18 08:07 mo-norant

Even though this is closed, for people in the future coming to see this. If you're using MSBuild on TFS (in-house, not VSTS), make sure if you've updated your project to .NET Core 2.1 from Core X.X, you need to open your publish profiles and make sure they are saved with netcoreapp2.1 instead of your older version.

AvogadroSG1 avatar Aug 03 '18 18:08 AvogadroSG1

@AvogadroSG1 suggestion also applies to web publish to Azure

Eonasdan avatar Aug 24 '18 13:08 Eonasdan

When I build on my local computer I have no problem. However when I use the azure pipe line the following error occurs.

Package Microsoft.Extensions.Primitives 2.1.6 is not compatible with netcoreapp2.1 Any suggestions?

WriterOfCode avatar Feb 27 '19 17:02 WriterOfCode

@WriterOfCode Did you ever figure this out? I have the same problem...I can build locally without issue. Azure pipeline throws errors for all of my NuGet packages:

Package GraphiQL 1.2.0 is not compatible with netcoreapp2.2 Package Microsoft.EntityFrameworkCore.SqlServer 2.2.4 is not compatible with netcoreapp2.2 So on and so forth....

holtjonathan avatar May 15 '19 03:05 holtjonathan

@holtjonathan I ran into this exact issue in an Azure Pipeline and fixed it by ensuring the pipeline got the latest version of nuget. I added the following before doing any builds. HTH you, anyone else who finds themselves here (and my future self debugging the same issue)!

- task: NuGetToolInstaller@0

akempe avatar May 20 '19 12:05 akempe

@holtjonathan I ran into this exact issue in an Azure Pipeline and fixed it by ensuring the pipeline got the latest version of nuget. I added the following before doing any builds. HTH you, anyone else who finds themselves here (and my future self debugging the same issue)!

- task: NuGetToolInstaller@0

Thanks for the suggestion @akempe. Forgive my newb experience with these pipelines but what type of task would I add so that I can get the latest version of nuget?

holtjonathan avatar May 20 '19 13:05 holtjonathan

@holtjonathan I ran into this exact issue in an Azure Pipeline and fixed it by ensuring the pipeline got the latest version of nuget. I added the following before doing any builds. HTH you, anyone else who finds themselves here (and my future self debugging the same issue)! - task: NuGetToolInstaller@0

Thanks for the suggestion @akempe. Forgive my newb experience with these pipelines but what type of task would I add so that I can get the latest version of nuget?

Nevermind...I see there is literally a task called "NuGetToolInstaller". I added this task to the beginning of my build and everything built successfully! Thanks @akempe!

holtjonathan avatar May 20 '19 13:05 holtjonathan

this is happening to me with 2.2. Any idea why?

Severity	Code	Description	Project	File	Line	Suppression State
Error	NU1202	Package Microsoft.Extensions.Configuration.EnvironmentVariables 2.2.0 is not compatible with netcoreapp2.2 (.NETCoreApp,Version=v2.2). Package Microsoft.Extensions.Configuration.EnvironmentVariables 2.2.0 does not support any target frameworks.	MyProjectName.Web	C:\Users\ackse\Desktop\test\MyProjectName-DotnetCoreAndAngular\MyProjectName.Web\MyProjectName.Web.csproj	1	

I solved the issue by Install-Package Microsoft.AspNetCore.All -Version 2.2.6 but I don't know why do I need to install this.

gorums avatar Jul 18 '19 03:07 gorums