32

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:

Only .NETCoreApp displays in the target framework list.

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.

2
  • 2
    in the .csproj, just change <TargetFramework>netcoreapp1.1</TargetFramework> to <TargetFramework>net46</TargetFramework> or <TargetFramework>net462</TargetFramework> - job done Commented May 4, 2017 at 16:16
  • @MarcGravell Is your comment also true for .net core with MVC? I wish there was a guideline for different conversion demands. Commented Mar 31, 2020 at 15:53

1 Answer 1

40

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.)

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks! I ran into this when adding my first dependency, so luckily VS had nothing to get confused about.
Worked here trying to connect to a ws-trust wcf service throws PlatformNotSupported exception, so back to .NET Framework platform works fine.. After configuring I had to add many and many NuGet packages tho
Is there any way to do this from netcoreapp2.2 to net48? I changed the project file but get an error that package Microsoft.AspNetCore.All 2.2.6 is not compatible with net48.
@mslissap: I believe you'll need to stop using that metapackage, and use the specific packages instead. See learn.microsoft.com/en-us/aspnet/core/migration/… which gives some instructions that might help you.
@Shemiroth: I don't know if ClickOnce supports .NET Core at all. stackoverflow.com/questions/56390876/… suggests probably not.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.