Change Target Framework in Visual Studio

You may need to change the .NET target framework of your application for long term support, new features or to change the C# version.

Let’s quickly jump to see how to change .NET version in Visual Studio. We are using Visual Studio 2019 in below Example.

Change target framework for a project of the solution

  1. Right click the project -> Go to Properties
  2. Under the Application tab, select the target framework

The C# version is also changed according to the .NET target framework selected. You may find which version is supported for particular .NET framework here

What if the required .NET framework version is not available in the drop down list

In this case you will need to install the required .NET Framework runtime on your system. The different versions can be downloaded from here

Once the required version is installed, you may restart visual studio to find the version in the dropdown.

If you have not installed .NET core and need to create an application in .NET Core, you may also install it by launching the Visual Studio Installer and then following below steps:

1. Launch Visual Studio Installer and Click the modify button

2. Under the workload Tab, check the “.NET cross platform Development” tab and click “Modify

Change Target framework of all projects in the Solution

You can change the target framework for the entire solution using a tool called “Target Framework Migrator“. Remember that this tool is not supported for .NET Core and further versions.

1. Install the Target Framework Migrator

2. While installing, select the Visual Studio version you need to install it to.

3. Restart Visual Studio

4. Open the Solution and under the Tools Menu, select the target Framework Migrator

5. In the popup, select the projects and Framework version and click on Migrate

Conclusion

We looked at ways to update the .NET framework version for our project. Please let us know about your queries or suggestions in the comment box.

Leave a Comment

Your email address will not be published.