65

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

Community
  • 1
  • 1
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • 1
    Despite having the framework already presentmI had similar issue for .net 4.5 based project in VS 2022 .So I followed the accepted answer from this Q&A - https://stackoverflow.com/questions/70022194/open-net-framework-4-5-project-in-vs-2022-is-there-any-workaround But on another machine the same solution didn't help so i just switched back to VS 2021. It worked perfectly alright. Hope this helps someone! – kaarthick raman Mar 24 '22 at 15:50

8 Answers8

107

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

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • 4
    +1, this is helpful, thanks. However, the link to the web page is all that's needed. Not so much changing the framework (annoying if you have multiple projects in a solution) – Assimilater Feb 11 '15 at 19:19
  • 5
    @Assimilater: link-only answers are discouraged on Stack Overflow – Thomas Weller Feb 11 '15 at 19:21
  • 2
    @Thomas: link-only answers are discouraged when the link contains actual information you can include in the answer, but in this case the link contains download links, and steps mentioned in your answer are unnecessary, so I would at least put the link at the top of this answer to make it more helpful. That being said, it seems that the link is not working anymore, and that the correct download link is now http://getdotnet.azurewebsites.net/target-dotnet-platforms.html. – vgru Feb 24 '16 at 12:56
  • 1
    Is this answer still relevant for VS2017? I'm running into this problem but Microsoft says this should be bundled with VS2017. The installer confirms that the developer pack is installed. – tyteen4a03 Jun 19 '18 at 10:40
  • @tyteen4a03: the linked webseite also says that it should be installed already. Can you uninstall and reinstall it via the Control Panel? Are you sure it is 4.5.2 and not 4.7.2? – Thomas Weller Jun 19 '18 at 11:20
  • I tried installing the .NET Framework 4.5.2. VS 2019 still says the .NET 4.5.2 framework is not installed – William Nov 12 '19 at 02:46
  • 1
    LIFE SAVERRRRRRRRRRRRRRRRRRR – Alireza Jamali Aug 29 '20 at 19:00
20

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.

  • I mistakenly tried installing the "Runtime" and that was already installed. I had to specifically install the "Developer Pack." This all makes sense in retrospect but I was definitely confused before I read this answer. – DubiousPusher Mar 30 '18 at 22:12
10

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.

komodosp
  • 3,316
  • 2
  • 30
  • 59
  • Same symptoms with .NET 4.7, same fix: opening up Programs and Features and the "Individual Tabs" and select the versions of .NET that you need. – TomEberhard Aug 15 '18 at 22:17
  • This also worked with VS 2019 and targeting 4.8.1, though in the VS Installer application the component is listed as "4.8", not "4.8.1" – M Herbener Nov 03 '22 at 20:11
9

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/

David Fawzy
  • 1,056
  • 15
  • 17
  • Thank you! When trying to download 4.5.2 Framework it kept telling me it already installed it, but I WAS able to install the Developer Pack and after doing so I was able to pick 4.5.2 as the target framework! – Levi Wallach Dec 08 '16 at 16:27
1

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

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.

Bink
  • 1,934
  • 1
  • 25
  • 41
1

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

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

nliu
  • 1
  • 1
    Welcome to StackOverflow and thanks for your help. You might want to make your answer even better by adding some explanation. – Kenzo_Gilead Aug 28 '17 at 15:02