Final answer:
To change the .NET SDK version in Visual Studio 2019, list installed SDKs using the command prompt, edit the project file to specify the desired target framework, optionally add a global.json file with the desired SDK version, and restart Visual Studio.
Step-by-step explanation:
To change the .NET SDK version in Visual Studio 2019, you need to follow a few steps. First, determine which SDK versions are installed on your system. Open a command prompt and enter dotnet --list-sdks to see a list of installed SDKs.
Next, you'll need to configure your project to use the specific SDK version. Open your project in Visual Studio 2019. Then, right-click on the project and select Edit Project File. Look for the <PropertyGroup> section.
Within <PropertyGroup>, add or modify the <TargetFramework> element to match the SDK version you want your project to target, for example, <TargetFramework>netcoreapp3.1</TargetFramework>. If you want to specify a particular SDK version, you can add a <GlobalJson> file to your project's root with the SDK version specified.
To create this file, run dotnet new globaljson --sdk-version 3.1.100 -- this will generate a global.json file which will control the SDK version used by everyone working on the project. Finally, save your project file and restart Visual Studio to ensure it uses the specified SDK version.