Switching to new ‘dotnet’ target framework monikers
Eilon opened this issue · 0 comments
Eilon commented
What is it?
These are a new, simpler way of targeting versions of .NET. More information here https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/standard-platform.md
Action required
For RC1 applications and test projects should still target dnx4x
and dnxcore50
and don't need to change at all. Anything that has a Program.Main
or Startup.cs
is considered an application.
Only _class libraries_ should change to target net4x
and dotnet5.x
. For class libraries the recommended conversion steps are:
In project.json
:
- Change
dnx4x
tonet4x
(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
Example
Here's what a project.json
file used to look like:
{
"version": "1.0.0-*",
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.11-beta-*"
}
}
}
}
And here's what to change it to:
{
"version": "1.0.0-*",
"frameworks": {
"net451": {},
"dotnet5.4": {
"dependencies": {
"System.Collections": "4.0.11-beta-*"
}
}
}
}
And in your CS files if you had:
#if DNX451
// whatever
#endif
...
#if DNXCORE50
// whatever
#endif
Change that to:
#if NET451
// whatever
#endif
...
#if DOTNET5_4
// whatever
#endif