Home > Enterprise >  How can I add .NET framework to my project?
How can I add .NET framework to my project?

Time:10-21

Currently I'm working on a Project where my first Form was not .NET framework. I'm trying to add a Windows Form App (.NET framework) to this project but I can't find anywhere on the internet how to do this.

When creating this project, instead of clicking on 'Windows Form App (.NET framework)' I clicked on the other one enter image description here

Is there any way to add the .net framework to my project?

CodePudding user response:

You can re-target your project by right-clicking in Visual Studio and choosing Edit Project or opening it in a text editor.

You are looking for the <TargetFramework> element. I would hazard a guess it is currently set to net5.0-windows updating it to NET48 will change the target framework.

You may have to fix some compilation errors if you have used any features from .NET 5 that are not available in .NET 4.8 but that can't be helped

CodePudding user response:

You should create another project, and this time select the right target framework. The one you selected runs on .net core.

CodePudding user response:

You can't simply just add the .NET Framework to your project. Those types are fundamentally different. Since you "only" have one form so far, I suggest you to create a new project within your current solution (right click on solution, add project) and then select the "Windows Forms App (.NET Framework)" and rebuild your existing form.

There are tools to convert the ASP form to an ASP.NET form, something like this https://archive.codeplex.com/?p=aspclassiccompiler (I have not used it but it seems to fit your problem) but I would say its much easier to recreate your single existing form.

  • Related