Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert .Net Core to .Net Framework

I have a .Net Core project web project, and for various reasons want to convert it to a .Net Framework project.

Is there an easy way to do this, or do I have to start again and import the code from the previous projects

like image 528
Richard Watts Avatar asked Mar 06 '17 10:03

Richard Watts


People also ask

Is .NET Core compatible with .NET Framework?

NET Framework can only run in . NET Framework-based applications and the libraries which target to . NET Core can only run in . NET Core compatible applications.

Is .NET Core better than .NET Framework?

Net Framework does not support the development and implementation of microservices but it supports the REST API services. . NET Core offers high performance and scalability.


2 Answers

I have loaded core project to the VS 2017 RC Community and open *.csproj in text editor.

Just delete teg

<RuntimeFrameworkVersion>

and replace

<TargetFramework>netcoreapp1.1</TargetFramework>

to

<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

And after all in project properties set to any another framework and reset back (VS reload and repair *.csproj file).

like image 72
Alexander Avatar answered Oct 17 '22 04:10

Alexander


This worked for me in VS2017:

Start with .net core web project template.

Edit *.csproj so it looks like this:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="2.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
  </ItemGroup>

</Project>

Save and close.

Try running project.

The PackReferences is just the NuGet files, and you can add them through the GUI if the versions are different from mine above.

like image 21
Greg Gum Avatar answered Oct 17 '22 04:10

Greg Gum