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?
Right click on the project in solution explorer, select properties, and go to the application tab. You will see that the correct framework is selected in target framework. If you want to target a different version, for example, an older version of . NET Standard for a library, you change that here.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With