I want to know if .NET Core 3.1 is backward compatible with .NET Core 2.1. I am getting below error while adding a nuget package(say package X) targeting .netcoreapp2.1 to my .netcoreapp3.1 project:
NU1202: Package is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package supports: netcore21 (.NETCore,Version=v2.1)
Note that the TFM netcore21 is not .NET Core 2.1.
Because the TFM netcorexx has been taken by some former deprecated platform that used to be called ".NET Core", which is not the well known .NET Core at all.
The proper TFM for .NET Core is netcoreappx.x (to be distinguished from the deprecated platform).
Thus this is irrelative to backward compatibility problem. And the nuget package that you are trying to add does not ever target any version of .NET Core.
Related
I created a pipeline but when the process failed all the time on "Nuget Restore", see error message below.
I don't understand why
Thanks for your help
*The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk\2.2.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity\PackSecurity.csproj] C:\Program Files\dotnet\sdk\2.2.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity.Tests\PackSecurity.Tests.csproj])
Packages failed to restore*
Use "windows-2019" as the agent. Click on "Agent job 1" and set "Agent Specification" as "windows-2019".
Let me know if it worked for you.
According to the error message:
The current .NET SDK does not support targeting .NET Core 3.0. Either
target .NET Core 2.2 or lower, or use a version of the .NET SDK that
supports .NET Core 3.0.
We could to know that you have one or more projects target to the .NET Core 3.0, but the agent you select does not have that version .NET Core installed by default. It should has version 2.2.11 installed.
To resolve this issue, we could add a Use .NET Core task to install the .net core 3.0.x:
Check the similar ticket for some more details.
Hope this helps.
I am trying to connect to SignalR hubs from an ASP.NET Core 2.1 project.
Looking at the documentation here: https://learn.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-2.2, it says a package reference to Microsoft.AspNetCore.SignalR.Client is required.
Looking at the NuGet site (https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/) for this library, no versions for .NET Core 2.X are available.
How come there are no versions for 2.1 available? What library can I use for connecting to SignalR hubs using .NET Core 2.1, if not Microsoft.AspNetCore.SignalR.Client?
The SignalR version numbers are a bit confusing because SignalR was actually not available with ASP.NET Core 1.x but came later with 2.x. And it shipped on a separate lifecycle which you can also see by the versions of the Microsoft.AspNetCore.SignalR package. So basically, the numbers are just very out of sync with ASP.NET Core versions.
They are fixing that in ASP.NET Core 3, where SignalR and its clients will be regular parts of ASP.NET Core, shipping normally with the framework and sharing version numbers.
For 2.x this basically means that you just pick the latest SignalR 1.x. To verify the best version, you should also look at the dependencies of Microsoft.AspNetCore.SignalR.Core which is the base dependency for both the client as well as the server package. You will see that it also depends on Microsoft.AspNetCore.Authorization. So that should be your indicator which version to use for which version of ASP.NET Core.
To summarize:
For ASP.NET Core 2.1, use version 1.0.4 of the server package and the client package.
For ASP.NET Core 2.2, use version 1.1.0 of the server package and the client package.
For ASP.NET Core 3.0, the server part already ships with ASP.NET Core and for the client use a 3.0 version.
Actually, you will not face any issue using the latest SignalR stable package (#aspnet/signalr#1) with .net core 2.1. Please see the related doc for more info.
Getting following error when i try to add reference of .net core library reference in my web app.
Microsoft Visual Studio
The following projects are not supported as references :
DiscoverLib has target frameworks that are incompatible with targets in current project DiscoverWeb.
DiscoverWeb: .NETFramework,Version=v4.5.2
DiscoverLib: .NETStandard,Version=v1.6
Yes, that's expected/normal. .NETStandard 1.6 requires .NET Framework 4.6.3 (aka vNext) which is an unreleased version of the .NET Framework.
See this matrix for information. If you want to target .NET Framework 4.5.1 your class library must be ".NET Standard 1.2" or lower. This reduce the number of API you can use, so you always need to balance between minimum version supported and newest API.
I wanted to create a new ASP.NET Core app targeting the new .NET Core 1.0.
First, in Visual Studio 2015 Update 3, I don't see .NET Core listed
And this is what I'm seeing in project.json file. Looks like I'm targeing dotnet5.6
Is it safe to assume this is all correct?
And if this is correct, could it possibly be more confusing?
The pulldown has no meaning for .NET Core projects as it doesn't use it. Only what's in project.json matters for .NET Core / .xproj projects.
netcoreapp1.0 target framework moniker (short TFM) is .NET Core project for executables (ASP.NET Web Application or .NET Core Console Application). netstandard1.x (see this matrix for api surface of netstandard TFM) is for class libraries.
The import section just tells nuget to also restore packages which target dotnet5.6 (old TFM for .NET Core Library, which is now replaced with netstandard1.x) and portable-net45-win8, which are also compatible with .NET Core. These allow you to install packages which are compatible but are not yet repackaged for netstandard1.x.
In a new WebAPI project (trying ASP.NET Core 1.0) we have a requirement to query a legacy database "Pervasive SQL" using the ADO.NET Provider they provide. However they don't have a EF6 provider so we are stuck using EF5.
Skipping Entity Framework and using the ADO.NET PSqlConnection directly requires "System.Data 2.0.0.0". That makes me think the provider is compiled on .NET Framework 2.0 (or 3.5).
project.json
"frameworks": {
"net451": { },
"dnx46": {
"dependencies": {
"EntityFramework": "5.0.0",
"Pervasive.Data.SQLClient.Entity": "1.0.0-*",
"Pervasive.Data.SqlClient": "1.0.0-*",
"Pervasive.Data.Common": "1.0.0-*"
}
}
}
Running "dnu build" results into the following exception
xx\..\Controllers\ValuesController.cs(22,18): DNX,Version=v4.6 error CS0012: The type 'DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Build failed.
0 Warning(s)
2 Error(s)
The real question: Does dnx46 require at least .NET Framework 4.5.1 ?
Or is it somehow possible to referencing .NET Framework 3.5 (or 2.0) from ASP.NET Core 1.0?
The version of the moniker tells you already: It requires .NET Framework 4.6.
For 4.5.1 you need the dnx451 moniker.
But the essence is, 4.5 is minimum framework to use the new ASP.NET Core 1.0 (ASP.NET 5). You can see the matrix and how the moniker work on the ".Net Platform Standard" page on github.
Observations
If a library targets .NET Platform Standard version 1.3, it can only run on .NET Framework 4.6 or later, Universal Windows Platform 10 (UWP), DNX Core 5.0 and Mono/Xamarin platforms.
If a library targets .NET Platform Standard version 1.3, it can consume libraries from all previous .NET Platform Standard versions (1.2, 1.1, 1.0).
The earliest .NET Framework to support a .NET Platform Standard version is .NET Framework 4.5. This is because the new portable API surface area (aka System.Runtime based surface area) that is used as the foundation for the .NET Platform Standard only became available in that version of .NET Framework. Targeting .NET Framework <= 4.0 requires multi-targeting.
Each .NET Platform Standard version enables more API surface, which means it's available on fewer platforms. As the platforms update, their newer versions jump up into newer .NET Platform Standard versions.
Platforms which have stopped updating -- like Silverlight on Windows Phone -- will only ever be available in the earliest .NET Platform Standard versions.
Note
Please note that the moniker described there are for the current nightly builds. There are slight differences to the current RC1 release, i.e. it's dnx and dnxcore for dnx applications (ASP.NET, Console, unit-test projects) and net and dotnet for "Class Library (Package)". In RC2 current builds and RC it will be net and netstandard (also see this answer).