'I cannot change the Target Framework from .NET 5.0 to .NET 4.8 for a C# .NET Framework Class Library in Visual Studio 2019
I am trying to build a .NET 4.8 Class Library that I can make COM-Visible as a support library from an Access application.
- There are no prompts for the version of .NET Framework when I create the solution.
- When I look at the Project Properties, the .NET Framework is set to 5.0.
- Although I have the .NET Framework 4.8 installed, it does not appear in the combo-box for the Target framework. The only options are shown below.
- I have also noticed that the Startup object combobox does not reflect the selected startup assembly.
Do I need to drop back to Visual Studio 2017 to create a .NET Framework 4.8 library?
Solution 1:[1]
Which SDK is installed? If you only have the .net 5 SDK installed, it might suffice for making a .net core 3 app but it will not cover .net Framework.
Install the .net Framework SDK for the version you want to target. And/or install a targeting pack if you want to target .net 4.8 and 4.7.2 for example. (Maybe helpful: What's the difference between the .NET Framework SDK and the Targeting pack)
Solution 2:[2]
This happened to me because I had choosen the wrong kind of project. I had choosen a project library for C#, Windows Linux, macOS. By this the same thing, that one could only had .NET 5.0 and higher as Framework. I had to create a new library project with only C# and Windows. Than I could choose all installed .NET frameworks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DasKrümelmonster |
Solution 2 |