6

I'm working with an old legacy project that uses .NET Framework v4.0 but I'm having trouble with running it. I cannot update the target framework because this is a massive legacy project that many people rely on. Whenever I try to start up the project I get this dialogue box telling me that I need the .NET Framework 4.0 targeting pack, but when I try to download and install, my system tells me I already have it. Anyone have any ideas for how I can fix this?

enter image description here

When I allow Visual Studio to open my browser, it seems that .NET Framework 4.0 runtime is my only option.

enter image description here

But once I double click on the installer in my downloads folder, I get told that I already have it. enter image description here


Edit: Someone linked another article How to install .NET 4 Framework in Windows 10 but this does not work for me. First, I already have .NET Framework 4.6 installed, and second the download link for the 4.0.3 multi targeting pack no longer works. When I click on the link, it leads me to this article. I tried to click this download link, and it led me to a default store page with nothing to download. Additionally, the article is about Visual Studio 2010, but I am currently using version 2022.

enter image description here enter image description here

wheeeee
  • 1,046
  • 2
  • 14
  • 33
  • Normally you can select that from project properties – sairfan Nov 07 '22 at 22:39
  • Related: https://stackoverflow.com/a/35734885/1364007 - I post [a link](https://support.microsoft.com/en-us/topic/multi-targeting-pack-for-the-microsoft-net-framework-4-0-3-2d3a5d77-889b-1ab1-ae8a-171d5f3cd870) to the 4.0.3 targeting pack which I think is what you need (I think 4.0 is covered by 4.0.3 - if not there's hardly any changes between the two). As you already saw, you have the runtime already as that is part of Windows. Note that 4.0 is no longer supported by Microsoft (neither is 4.0.3) - though I realise you can't upgrade to 4.8. – Wai Ha Lee Nov 07 '22 at 23:09
  • See if this [link](https://learn.microsoft.com/en-us/answers/questions/993957/how-to-target-net-framework-40-in-vs-2022-on-windo.html) helps you – Mark Hall Nov 08 '22 at 02:27
  • @WaiHaLee while that's a useful thread, your answer isn't. The answers from foxx1337 was the correct one that pointed out what's needed for .NET Framework 4.0 targeting, not 4.0.3. – Lex Li Nov 08 '22 at 06:48
  • @LexLi - aha- thanks for the clarification. I knew that the 4.0.3 targeting pack definitely covers 4.0.1 and 4.0.2 but wasn't 100% sure about 4.0. – Wai Ha Lee Nov 08 '22 at 08:47
  • To be overly clear, Lex Li is referring to [foxx1337's answer at the other question](https://stackoverflow.com/a/45509430/1028230) (not to an answer posted here; EricBlousot isn't a new name for foxx1337 or whatever). That said, @EricBlousot's answer seems easier -- use the Visual Studio Installer and grab it under Individual Components. I don't _think_ you need to install 2019 first to do this. – ruffin Aug 02 '23 at 14:56

2 Answers2

4

I solved this problem downloading VS2019 (https://learn.microsoft.com/en-us/visualstudio/releases/2019/redistribution#vs2019-download) and using the VS Installer to install individual component ".NET Framework 4 Targeting Pack"

1

I solved this problem by download .net40 package manager from nuget.

https://www.c-sharpcorner.com/article/open-legacy-projects-4-5-framework-in-visual-studio-2022/

Nicky Apriliani
  • 321
  • 4
  • 25