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

Roman Pokrovskij
  • 7,969
  • 14
  • 68
  • 119

3 Answers3

20

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

Roman Pokrovskij
  • 7,969
  • 14
  • 68
  • 119
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.

Basil
  • 587
  • 1
  • 9
  • 17
0

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

Build settings under "project" properties.

Advanced settings

John Walthour
  • 636
  • 2
  • 7
  • 20