Target A .NET Framework In Visual Studio

Introduction 

On August 7, 2014, Microsoft announced that on January 12, 2016 support will end for .NET Framework 4, 4.5, and 4.5.1. It is therefore important to update our .NET 4.x projects to the supported versions of the .NET framework.   

 
However it may happen to have a particular version of the .NET Framework correctly installed in our environment with Visual Studio not showing it in the Target Framework drop-down of our project. In this article we will show you how to solve this inconsistency. 

Targeting the .NET Framework

As an example we have created an application in Visual Studio 2013. The goal of this example is to use the .NET Framework 4.5.2. To select the requested framework, we right click the project and select Properties: 
 
  
 
Then we open the Target Framework drop-down and look for the .NET Framework 4.5.2. As we can see in the figure, the version 4.5.2 is not available in the drop-down. 
 
Visual Studio Target Framework Dropdown 
 
To check if the .NET framework is correctly installed in our PC we search the registry for the following key:

KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP.
 
Reading the "Release" value we can deduce which version of the framework is installed.  For more information on how to determine which .NET version is installed, please refer to the MSDN documentation.
 
In our particular case, it is clear that the .NET framework 4.5.2 is correctly installed (see figure below). 
 
 
Installing the .NET Targeting Packs
 
To have the .NET Framework 4.5.2 correctly shown in Visual Studio we need to install the related .NET Targeting Packs. There are several packs available for different versions of Visual Studio. Be careful to select the correct version of Visual Studio before downloading the pack. In our example we are going to download the packs related to the .NET frameworks 4.5.1 and 4.5.2 (for Visual Studio 2013).
 
After installing the Targeting Packs in our environment, the .NET frameworks 4.5.1 and 4.5.2 will now be available and can be selected in Visual Studio 2013 drop-down menu. 
 


Conclusion

The support to the .NET Framework 4, 4.5 and 4.5.1 will end on January 12, 2016. Only the .NET Framework 4.5.2 will continue receiving technical support and security updates. Due to the Microsoft Support Lifecycle Policy, it's important to update our projects to avoid future issues related to security, stability and performance. 

Up Next
    Ebook Download
    View all
    Learn
    View all