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).
Related
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.
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.
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.
I just installed the ASP.NET MVC 4.0 RC build on top of a Visual Studio 2010 SP1. My project that used to compile and work with the beta version of ASP.NET MVC 4.0, raises an error when I access the site saying that the Newtonsoft.Json assembly version 4.5 can not be found.
As I did not use this third party library in my current project, I configured Fusion Log to try to isolate the assembly that was relying on Newtonsoft.Json assembly.
And the guilty assembly is System.Net.Http.Formatting.dll which references Newtonsoft.Json version 4.5.
The beta build referenced System.Json.dll and not the Newtonsoft assembly.
I can hardly believe that Microsoft is starting to rely on external assemblies even if they publish more and more code in open source.
Does anyone have an explanation of what happened?
They are actually relying in third-party software (just like they ship MVC with JQuery and knockout.js). Scott Guthrie announced that MVC 4 will be shipped with JSON.NET (Newtonsoft). See below:
Json.NET: We plan to use the community developed Json.NET
serialization stack in our default JSON formatter in ASP.NET Web API.
Json.NET provides the flexibility and performance required for a
modern web framework.
http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap
You can keep the System.Json.dll btw, I've got them both. If you have any problems with JSON.NET, just reinstall it :)