问题描述
如何在新的核心asp csproj项目中使用VS 2017 RC更改目标框架?
我的意思是在项目创建后进行更改。 VS 2015中没有用于该项目的project.json文件。在下拉目标的项目属性中,除了 .NETCoreApp 1.1和 .NETCoreApp 1.0之外没有其他选项。
详细信息:我已使用yoman生成SPA项目:
以这种方式编辑 csproj
文件:
< ; TargetFramework> netcoreapp1.1< / TargetFramework>
替换为:
< TargetFramework> net462< / TargetFramework>
< RuntimeIdentifier> win7-x86< / RuntimeIdentifier>
并删除:
< PackageReference Include = Microsoft.NETCore.App Version = 1.1.0 />
然后
dotnet恢复
dotnet构建
可选:
dotnet运行
不要从Package Manager控制台开始 dotnet运行
。它开始了,但是使用 ctrl c
(标准方式)来停止Web应用程序是不可能的。
如果VS F5
不起作用(对于VS 2017 RC是正确的,使用yoman模板生成的核心服务),然后更改:
< OutputType> winexe< / OutputType>
到
< OutputType> Exe< / OutputType>
并重新启动VS,重新生成是不够的(要启用F5,对于VS 2017 RC同样如此)。
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?
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).
这篇关于如何更改VS 2017 RC .csproj项目的目标框架(从核心到经典)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!