How to upgrade from .net core 2.1 to .net core 5 ?

ahmed salah 3,216 Reputation points
2022-10-22T12:29:24.977+00:00

I work on visual studio 2019 when create new project with .NET core web application it display to me as .NET core 2.1
i need to create new project on visual studio 2019 with .NET core 5.0
so what i do to display .net core 5.0 when create new web application project with .net core
i install dotnet-sdk-5.0.408-win-x64 and then run
dotnet --version
it display
C:\Users\MBR>dotnet --version
5. 0.408
and restart my pc after install sdk 5.0
then create new project it still .net core 2.1
so how to upgrade from .net core 2.1 to 5.0

se issue below253186-upgradr-from-netcore21-to-5.png

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,649 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,141 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,106 Reputation points Microsoft Vendor
    2022-10-24T06:17:47.777+00:00

    Hi @ahmed salah ,

    i need to create new project on visual studio 2019 with .NET core 5.0
    so what i do to display .net core 5.0 when create new web application project with .net core.
    then create new project it still .net core 2.1
    so how to upgrade from .net core 2.1 to 5.0

    You can try to add the .Net 5.0 to the Target Framework List via the Visual Studio Installer.

    Refer to the following steps:

    1. Open the Visual Studio Installer. Choose the selected Visual Studio, then click the Update button to update it to the latest version. Then, click the Modify button. 253387-image.png
    2. In the Modify popup window, select the "Individual components", then checked the .Net 5.0 Runtime. After that, click the Modify button that the bottom to install the relates components. 253397-image.png
    3. Restart the Visual Studio 2019 and create the new asp.net core application, you can see the .Net 5.0 target framework: 253350-image.png

    Besides, to upgrade the Application from 2.1 to 5.0, you can refer the following articles to migrate the application step by step.

    Migrate from ASP.NET Core 2.1 to 2.2

    Migrate from ASP.NET Core 2.2 to 3.0

    Migrate from ASP.NET Core 3.0 to 3.1

    Migrate from ASP.NET Core 3.1 to 5.0


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments