62
votes

When opening an already existing solution in Visual Studio, it says

The C# project "..." is targeting ".NETFramework,Version=v4.5.2", which is not installed on this machine.

Screenshot error message

I have already tried

8

8 Answers

102
votes

Official list of all targeting packs: https://www.microsoft.com/net/targeting. Make sure you download the "developer pack", not "runtime".

Direct links to offline installers: 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2

This problem seems to affect Visual Studio 2013 and Visual Studio 2015. The targeting packs are included in Visual Studio 2017.

Outdated links:

How I found that link

First, choose option 1, "Change the target to .NET Framework 4.5"

Next, go to the project options of the affected project, select "Application" and then choose "Install other frameworks..." from the list of target frameworks:

Screenshot Change target framework

This brings you to a website where you can choose your version of Visual Studio and download the targeting pack (called developer pack).

Website screenshot

17
votes

I had the same issue. When I loaded the project it always asked for the .NET framework 4.5.2 and I was not able to install it because it always said that it was already there.

What worked for me was to install the Microsoft .NET Framework 4.5.2 Developer Pack from https://www.microsoft.com/en-us/download/details.aspx?id=42637

Give it a try. It may work for you as well.

9
votes

You need to download the .NET Framework 4.5.2 Developer Pack That link compile all the frameworks in one place

http://scottge.net/2015/07/04/a-complete-list-of-microsoft-sdks-for-download/

9
votes

I had this issue with .NET 4.6.2 (VS2017) - I downloaded the Developer pack from the link provided by the error message and installed, but it didn't help.

But then I opened up the Programs and Features in Windows Control Panel, and selected to "Change" Visual Studio 2017. The installer contains a tab entitled "Individual Components", and in there I saw that Targeting Pack for 4.6.2 was not selected.

Selecting them and selecting "Modify" fixed the problem.

1
votes

I faced the same problem. In spite of installing developer pack, problem did not seem to go away. I did a VS 2015 repair and voila it started working.

1
votes

I was getting the same problem but downloading the NETFramework Targeting Pack didn't resolve the issue. I was prompted to change the version or download the correct version. Neither option worked. I could see .NET Framework in the registry, on the Visual STudio installer and on the turn programs on and off and verified they were there. Turns out Visual Studio 2017 Community and 2019 Community installed on c:Program Files. So it looks here for the framework files. C:\Program Files\Reference Assemblies\Framework.NETFramework\v????? For whatever reason the .NETFramework files all loaded here C:\Program Files (x86)\Reference Assemblies\Framework.NETFramework\v????? Once I copied one of the folders from x86 to the other, it worked and it was recognized and no more error. I searched but the best solution I found was to create a symbolic link from the one folder to the other. I didn't feel making a copy was a good long term solution. So I used mklink and linked the x86 folder to the other. Now it's working perfectly!

-1
votes

.NET framework is not the same as Targeting Pack. The later needs to be installed in order for Visual Studio to work properly.

-1
votes

For what it’s worth, after I installed the required Developer Pack, I had to restart Visual Studio before it was detected. Hope this helps someone.