How to upgrade a c# desktop app to .NET 8.0

Peter Deans 20 Reputation points
2024-08-12T07:40:46.6333333+00:00

I have a C# desktop app currently using .NET 4.8 which is using C# version 7.3. My visual studio version is 17.10.5 and I have downloaded and installed the .NET 8.0 SDK and checked it's installed .

When I change the TargetFrameworkVersion setting in the csproj file to v8.0 VS won't load the project saying the targeted framework isn't installed and it reverts back to 4.8.

I need to use functionality in later versions of C# (version 8.0 as a minimum) so I need help getting VS and my app to recognise that .NET 8.0 is installedOne thing that looks different is that my csproj file has <TargetFrameworkVersion> rather than <TargetFramework> so I don't know if that's an issue.

If I change this setting to 8.0 VS says the version isn't installed. If I change it to net8.0 I get the following error...

User's image

<TargetFrameworkVersion>
.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,103 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,449 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,349 questions
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 49,511 Reputation points Microsoft External Staff
    2024-08-12T08:48:02.5966667+00:00

    HI @PETER DEANS , Welcome to Microsoft Q&A,

    We generally do not recommend modifying the csproj file directly, you can use the Upgrade Assistant.

    Here are the relevant links:https://learn.microsoft.com/en-us/dotnet/core/install/upgrade

    Best Regards,

    Jiale


    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.