How to change VS 2017 RC .csproj project's target framework (from core to classic)?

好久不见. 提交于 2019-11-30 05:16:43

Edit csproj file this way:

<TargetFramework>netcoreapp1.1</TargetFramework>

replace with:

<TargetFramework>net462</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>

and remove:

<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />

Then

dotnet restore
dotnet build

Optional:

dotnet run

Do not start dotnet run from Package Manager Console. It will work but it wil be impossible to cancel web app with ctrl c.

If VS F5 doesn't work, (true for VS 2017 RC, core services generated with yoman templates), then change:

<OutputType>winexe</OutputType>

to

<OutputType>Exe</OutputType>

and restart VS, rebuild is not enough (to enable F5, again true for VS 2017 RC).

The safest option, if you have a few files, is to just add a new project with the correct framework. Then copy the files from the old project across. This will stop you having build and other issues.

.NET Core for example has its own class library, console and test types.

They've moved the option. It's now under the "Build" tab, under the "advanced" button.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!