I'm writing a class library for a simple parser in C#. When I first created it, I used .NET standard 2.0, but now I need to migrate it to .NET 4.6 both to conform to the other projects in my solution and in order to use NUnit.
I tried to follow the instructions in the Microsoft documentation, but when I try to select another framework in the properties, I can only find other .NET standard versions.
How can I migrate it? Will I need to manually edit the .csproj
file?
NET Standard 2.0. . NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.
In Visual Studio select Analyze and then Portability Analyzer Settings. In the General Settings window, select . NET Standard 2.0 under Target Platforms, and then choose OK.
Open up the project file (.csproj) and change the TargetFramework
to net462
<PropertyGroup> <TargetFramework>net462</TargetFramework> </PropertyGroup>
My personal experience in Visual Studio 2017 is that recreating project and adding existent sources is the simplest, safest and most effective way - because .Net Framework based csproj file has extra xml elements (comparing with Standard based), it seems changing "TargetFramework" is not enough. Below is portion of diffs appeared by default:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With