How to compile dotnet 6/7 in vs2019

Jeroen van Langen 0 Reputation points
2023-01-13T10:14:55.0766667+00:00

Hi there,

Just before Visual studio 2022 was released (we didn't see any upcoming releases at that point), our company bought a dozen of licenses for visual studio 2019, so that we can make the step to dotnet 5 applications.

Within a year, dotnet 5 became obsolete. Now it is not possible for us to make dotnet 6 or 7 applications in visual studio 2019. I've seen some "solutions" to this, but does not work.

We have actually bought a pig in a poke because of this.

I actually think that Microsoft should contribute to this.

Jeroen.

Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-01-13T12:48:19.3866667+00:00

    Hi @Jeroen van Langen ,

    Welcome to Microsoft Q&A! 

    Visual Studio 2019 supports the .NET version 5 (Visual Studio 16.8 or later). Visual Studio 2022 supports the .NET version 6 and 7.

    But you can try the following steps:

    1. Manually install the .NET 6 SDK.
    2. Update your VS2019 to the latest version
    3. Go to Tools > Options > Environment > Preview Features > enable “Use previews of the .NET Core SDK”.
    4. Restart your VS2019
    5. Change the target framework from .NET 5 to .NET 6

    <TargetFramework>net6.0</TargetFramework>

    1. Save your project file and build your project again (it may have a warning) 

    If it still doesn’t work, I would like to recommend you use VS2022. 

    Or you can also report to product team to add .NET 6/7 support in VS2019:

    Visual Studio Feedback 

    Thanks for your understanding! 

    Sincerely,

    Anna


    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.

     


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.