What am I missing to upgrade asp.net mvc .net core 2.2.0 apps to .net core 2.2.1 - asp.net-core

I have the latest version of visual studio, the sdk and runtimes for x64 and x86 version 2.2.1, but my asp.net mvc .net core applications will only recognize being 2.2.0. I can install 2.2.1 into .net core libraries.
What do I need to change to allow my web projects to be 2.2.1 instead of 2.2.0?
(It can't be done through nuget, it provides the statement: Implicitly refrenced by an SDK. To update the package, update the SDK to which it belongs
Since the project is referencing a library with 2.2.1, I see the error: Error NU1605 Detected package downgrade: Microsoft.AspNetCore.App from 2.2.1 to 2.2.0. Reference the package directly from the project to select a different version.)

According to Microsoft documentation packages Microsoft.AspNetCore.App and Microsoft.NETCore.App have special versioning semantics which is handled outside of NuGet.
Also note that specifying a version number on Microsoft.AspNetCore.App package does not guarantee that desired version will be chosen. In general, you should not explicitly specify Microsoft.AspNetCore.App version unless you have a good reason to do so (applies to .NET Core 2.1 and later).
You can read more about that here: Microsoft.AspNetCore.App metapackage
If you want to target specific SDK used in your project or solution, add global.json file to project folder (if you want to target only that specific project) or solution folder if you want to target all projects in the solution.
global.json example:
{
"sdk": {
"version": "2.2.103"
}
}

Related

Can't install the Xero.NetStandard.OAuth2

I cannot install the Xero.NetStandard.OAuth2 Nuget package from either VS2017 or VS2019. The error is:
Could not install package 'Xero.NetStandard.OAuth2 3.16.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', 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.
While my web app is .NET Framework version 4.6.
The Xero NetStandard SDK targets .NET Standard 2.0 and is only compatible with .NET Framework > 4.6.1.
You can see all the compatible frameworks for .NET Standard 2.0 here:
.NET implementation support

NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires

In the solution that I have to work with, I have to add a test harness for a number of library projects.
It has to be a .NET Core 2.1 (and it will stay this way for the reasons beyond my control) ASP.NET web service.
NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires Microsoft.AspNetCore.Razor.Design (>= 2.1.1 && < 2.2.0) but version Microsoft.AspNetCore.Razor.Design 2.2.0 was resolved.
I created a brand new project of the type "Asp Net Core Web Application", and when I built, I got the error above.
What is the meaning and reason of this error in a brand-new project created by VS?
You are getting this issue, because while your Microsoft.AspNetCore.Razor.Design version is 2.2.0 but ASP.NET Core application is still at 2.1.
You just need to change your package Microsoft.AspNetCore.Razor.Design2.2.0 to Microsoft.AspNetCore.Razor.Design2.1.x in your project file.
The issue described in Microsoft documentation as NuGet Warning NU1608:
A resolved package is higher than a dependency constraint allows. This
means that a package referenced directly by a project overrides
dependency constraints from other packages.
Possible solution:
Update the package version according to its dependency constraints.
For example in this case:
Update Microsoft.AspNetCore.Razor.Design 2.2.0 to 2.1.x according to its dependency Microsoft.AspNetCore.App 2.1.1

Why does netcore3.1 framework cause this error?

I have an aspnetcore api project I wrote in .net core 2.2, and changed the targeted framework in the csproj file to .net core 3.1. The project now has the following error (NETSDK1):
The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference to Microsoft.AspNetCore.App should be used instead, and will be implicitly included by Microsoft.NET.Sdk.Web.
C:\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets
The Nuget Viewer for the project has no such project listed, and the error is occurring in a file outside my project. Does anyone know how to fix this?

Nuget for Microsoft.NETCore.App 3.0.0 not available?

We are facing memory leak with ConfigurationRoot. Looking at this thread, it's now been fixed:
https://github.com/aspnet/Extensions/issues/861
This requires us to upgrade to Microsoft.NETCore.App 3.0.0
https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Abstractions/
But, I am not able to locate Microsoft.NETCore.App 3.0.0 nuget anywhere. Any idea where I can find this?
Microsoft.NETCore.App is a metapackage, which references all commonly used library for an .NET Core application. Install a new .NET SDK Runtime on the target system.
The version will still be 3.0.0, but when you run the application it will roll-forward to the newest patch version.
If its an self-contained application (vs. portable application which requires a .NET Core runtime installed on target system), then update the SDK on the build system and recompile your application to cause build system putting the latest .NET Core artefacts in the publish directory.

How to update from Microsoft.NetCore.App 2.0 to 2.1.4

I created an ASP.NET Core Web API project in Visual Studio 2017 version 15.7.2.
When I created it, it was Microsoft.NetCore.App 2.0.
Now I want to update to Microsoft.NetCore.App 2.1.4 but I can't because Visual Studio tells me:
Implicitly referenced by an SDK. To update the package, update the
SDK to which it belongs
I download the latest version of .NET Core and I installed it, but I got the same issue.
Any ideas?
Don't confuse SDK (=> Build tools) versions with .NET Core versions.
The 2.1.* SDK versioning was unfortunate, the versioning scheme has since been changed and the scheme transition will be (mostly) complete with the release of .NET Core 2.1.
You don't need to update the Microsoft.NETCore.App NuGet package as it only contains build references needed to build your application.
For self-contained applications, you can also set the <RuntimeFrameworkVersion> property inside the csproj file, but starting with the .NET Core SDK 2.1.300, you no longer need to as it will know about the latest versions.
As Martin points out above, the SDK and .Net Core Runtime are separate entities.
I went to https://www.microsoft.com/net/download/windows and downloaded the latest SDK (2.1) and installed it on my local machine. You'll need to close any open VS instances to complete the SDK installation.
Open your project's csproj file and update netcoreapp2.0 to netcoreapp2.1 and while you're at it you can update the "Microsoft.AspNetCore.All" to version 2.1. This will save you from having to update the nuGet package.
Worked for me. Best of luck.