问题
I am trying to develop my first ASP.Net web application and in my solution I have two projects. A Web Application
and Class Library (Package)
and noticed that the Web App has this for it's framework inside the project.json
"frameworks": {
"dnxcore50": { }
}
My understanding is that code makes my Web App target Net 5.0 Core but if I look at the project.json
for the Class Library I see this:
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
I have never heard of dotnet5.4
and what I read from google just confuses me. I think the net451
is the equivalent to dnx451
but I am not 100% on that.
What do I need to change in my project.json
to get it to target the new .Net 5.0 core?
回答1:
This is the result of the upcoming .NET Standard Platform. You can see the changes regarding this specific to rc1 here, the main part being;
Only class libraries should change to target net4x and dotnet5.x. For class libraries the recommended conversion steps are:
In project.json:
- Change dnx4x to net4x (e.g.
dnx451
tonet451
)- Change
dnxcore50
todotnet5.4
And in your CS files:
- Change
#if DNX451
to#if NET451
- Change
#if DNXCORE50
to#if DOTNET5_4
来源:https://stackoverflow.com/questions/34366900/dnxcore50-framework-support-in-asp-net-5-class-library-package-project