简体   繁体   中英

How can I convert a .NET Core project to a .NET Framework project?

I created a "Console App (.NET Core)" project in Visual Studio. Now I need to add a dependency that only works on .NET Framework 4.6+, not .NET Core.

Is there a way to convert my project to a full .NET Framework project?


Here's what I've tried:

I went to the project properties and attempted to change the project framework, but I don't see the option I need in the dropdown:

目标框架列表中仅显示.NETCoreApp。

If I click "Install other frameworks..." I'm taken to a page that says .NET Framework versions are included in Visual Studio 2017 -- which is exactly what I'm using to edit this project. This is where I got stuck.

If you're happy with it still using the new tooling, the easiest approach is probably just to edit the project file (csproj). Right-click on the project in Solution Explorer and you should have a context menu option of "Edit <yourproject>.csproj". Click on that, and just change

<TargetFramework>netcoreapp1.1</TargetFramework>

to

<TargetFramework>net46</TargetFramework>

... and I suspect you'll be good to go. (It may confuse VS for a little while as it restores appropriate packages etc.)

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