36

please help.

I have installed quite a lot of framework and development pack. as you can see in the image.

downloaded .net framewoek

unfortunately I want to access an ancient project. this project runs on .net framwork 4.5, and must not be upgraded.

I have visual studio 22 installed, but whenever i open the solution, i get the following error as seem in the image bellow.

dot net 4.5 error

At the moment I have succeeded in installing the target park for 4.5.2 but it is not helping.

I have tried to install the .net framework 4.5 runtime, but i get the error bellow.

enter image description here

Please help

10
  • 3
    Why cannot the project be updated? If it is actively maintained it should probably be updated to 4.8, if it is not, it should not need fixing. If you absolutely have to maintain out of support software, you should probably also maintain a compatible development environment, since there is no guarantee that out of support software will work in a modern environment. Commented Sep 8, 2022 at 12:06
  • 2
    Also, you lack a targeting pack for .Net 4.5, and this is different from 4.5.1. Note that support for 4.5 ended in 12 jan. 2016. Commented Sep 8, 2022 at 12:09
  • hello @jonasH thanks for reaching out. I have tried installing the 4.5 but it is not working. says newer package has been installed. Please, if you can find the target pack for .net 4.5 please tell me Commented Sep 8, 2022 at 12:14
  • @jonasH the project cannot be upgraded please Commented Sep 8, 2022 at 12:16
  • 2
    Found this article that details the same exact problem Commented Sep 8, 2022 at 15:51

4 Answers 4

62

Look @ article - https://www.gnostice.com/docs/docstudio_net/guide/_faq_buildinganddeployment_vs2022_and_netframework45.html

Total 3 solutions:

Option 1: Install Visual Studio 2019. This will enable support for building even in Visual Studio 2022.

Option 2: Download the Windows 8 SDK from here and when installing it choose the option to install .NET Framework 4.5.

Option 3: Follow the steps below to manually copy over the targeting pack to your machine.

  1. Download Microsoft.NETFramework.ReferenceAssemblies.net45 from NuGet

  2. Open the package as a zip file

  3. Copy the files from build\.NETFramework\v4.5 folder to Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5

Sign up to request clarification or add additional context in comments.

6 Comments

I recommend the 3rd option, it works like a charm! Thanks for posting this @aru
Option 3 still works even on Visual Studio 2022, thanks for the answer!
Used Option 3 - fast and easy. Thanks alot!
Just noting that the destination folder may already exist... back it up and copy the v4.5 folder from the NuGet package anyway. The contents are different, and it will fix the problem.
Option 3 still works on Visual Studio 2025, thanks for the answer!
|
26

With help of @JonasH and @Narish, I took time to study the documentation to understand what is happening.

Following an article referenced by @Narish, I made a copy of the v4.5.1 folder in the .NETFramework dir, which is still compatible with v4.5 and renamed it to v4.5

enter image description here

As of this moment, the legacy code and & still opens.

2 Comments

And it's still a mystery why we'd ever need to do this when Microsoft could've provided a solution inside the Visual Studio Installer app.
thx worked for vs 2022
7

You can download the windows dev kit from here

  1. https://www.gnostice.com/docs/docstudio_net/guide/_faq_buildinganddeployment_vs2022_and_netframework45.html
  2. When installing it only choose the option to install .NET Framework 4.5 and browse to this path C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework
  3. Close Visual studio and re-open it.

Comments

5

download:

https://download.visualstudio.microsoft.com/download/pr/03097ab1-852b-45d3-abbb-c0bcf640cd6f/4a22b5f5449d1e1182e17c0348b159ad/netfx45_dtp.cab

https://download.visualstudio.microsoft.com/download/pr/aa968ee4-54e7-4773-a9a5-bd09d7ca9924/ccc6eff9c0f4488e8f3bf5d1237684cbb67ff381b9784f9f7f653504a5d74ee2/netfx45_dtp.msi

Install: netfx45_dtp.msi EXTUI=1

3 Comments

Thanks for providing the approach to address our requirement . This is helping us to allow to run old solutions
This (at least) seems to be a much better option than the extract from NuGet package option (- thanks).
this is fast and strong reliable. saved my day

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.