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>
Developer technologies | .NET | Other
Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

Accepted answer
  1. Anonymous
    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.