18

I have a solution in C# in Visual Studios. It was first created in .NET Framework. I want to convert the project to .NET Standard/Core. If I go into project --> properties I see the attached screen, where Target Framework is .NET Framework. How am I able to change that to .NET Standard/Core?

project --> properties: Target Framework Currently set to .NET Framework

ENV
  • 877
  • 2
  • 10
  • 32
  • 2
    Does this answer your question? [Convert .Net Framework 4.6.2 project to .Net core project](https://stackoverflow.com/questions/48057514/convert-net-framework-4-6-2-project-to-net-core-project) – MindSwipe Sep 03 '20 at 12:16
  • 4
    This is probably an old-style csproj, yes? You kinda need to convert it to new-style ("SDK" style) csproj. For simple projects, this is trivial and is usually easiest done by simply creating a new-style csproj from scratch. – Marc Gravell Sep 03 '20 at 12:17
  • 1
    https://learn.microsoft.com/en-us/dotnet/core/porting/ – Roman Ryzhiy Sep 03 '20 at 12:17
  • 3
    If it's a relatively simple project, with little to no external dependencies, that has the VS 2017 and upward style .csproj format it's very easy, simply open your .csproj file in a text editor and change the `` to `netcoreapp3.1` (or whatever .NET Core version you want), but make sure you have the right [SDK](https://dotnet.microsoft.com/download) installed. If it's an "old-school" style csproj format you'll first need to convert it (like [this](https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/)) – MindSwipe Sep 03 '20 at 12:20

1 Answers1

18

As Roman Ryzhiy mentions in the comments, this is the way to go:

https://learn.microsoft.com/en-us/dotnet/core/porting/

This worked fine for me, I upgraded a .NET Framework 4.7.2 projekt. It was a small project, so I had few aftermath-problems. After the upgrade, the Target Framework in the Application tab will say ".NET 5.0".

  1. Install upgrade-assistant:

    dotnet tool install -g upgrade-assistant

  2. Go to your solution folder

  3. Run the assistant:

    upgrade-assistant upgrade your-project-name.csproj

  4. Follow the steps in the assistant, it's really straight-forward.

Also, here are the steps more detailed:

https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview#installation-steps

Tornseglare
  • 963
  • 1
  • 11
  • 24