简体   繁体   中英

How can I add .NET framework to my project?

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在此处输入图片说明

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

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM