14

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

Ishmaeel
  • 14,138
  • 9
  • 71
  • 83
Rikudou En Sof
  • 526
  • 1
  • 4
  • 21
  • 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. – JonasH Sep 08 '22 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. – JonasH Sep 08 '22 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 – Rikudou En Sof Sep 08 '22 at 12:14
  • @jonasH the project cannot be upgraded please – Rikudou En Sof Sep 08 '22 at 12:16
  • @RikudouEnSof **Why** do you say "the project cannot be upgraded"? – Dai Sep 08 '22 at 13:33
  • 2
    Found [this article](https://thomaslevesque.com/2021/11/12/building-a-project-that-target-net-45-in-visual-studio-2022/) that details the same exact problem – Narish Sep 08 '22 at 15:51
  • @Dai There are many other projects that are inter dependent. I will have to upgrade loads of projects. – Rikudou En Sof Sep 09 '22 at 10:15
  • To everyone else here, you can get the reference assemblies by installing (up to) Visual Studio 2019 as well since they are packaged with that edition of Visual Studio. – John Baker Feb 08 '23 at 17:07

3 Answers3

15

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.

Rikudou En Sof
  • 526
  • 1
  • 4
  • 21
7

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

aru
  • 413
  • 4
  • 14
3

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.
SangLT20
  • 31
  • 2