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

3

15

How to change target framework with VS 2017 RC in new core asp "csproj" projects?

I mean to change after project was created. There are no project.json file which was used for that in VS 2015. In project properties in targets "pull down" there are no other options then ".NETCoreApp 1.1" and ".NETCoreApp 1.0".

Details: I have used yoman to generate SPA project: http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/

so I was unable to select .NET Framework during the csproj creation. What to do now?

enter image description here

Torticollis answered 2/1, 2017 at 21:32 Comment(2)
Take a look at here: github.com/dotnet/cli/issues/4996Condominium
@YaserAdelMehraban if all is as it looks we should admit that all MS core teams works in other dimension...Torticollis
T
22

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 starts but it become impossible to stop web app with ctrl c (standard way).

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

Torticollis answered 3/1, 2017 at 19:51 Comment(0)
C
4

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.

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

Chuckchuckfull answered 21/8, 2018 at 7:52 Comment(0)
I
0

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

Build settings under "project" properties.

Advanced settings

Irishirishism answered 10/8, 2018 at 15:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.