2017-01-02 64 views
7

如何在新的核心asp「csproj」項目中用VS 2017 RC改變目標框架?如何通過VS 2017 RC改變目標框架?

我的意思是在創建項目後進行更改。在VS 2015中沒有使用project.json文件。在目標「下拉」的項目屬性中,沒有其他選項,則選擇「.NETCoreApp 1.1」和「.NETCoreApp 1.0」。

詳細信息:我已經使用yoman產生SPA項目:http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/

所以我無法在創建的csproj中選擇.NET框架。現在做什麼?

enter image description here

+0

看看這裏:https://github.com/dotnet/cli/issues/4996 – Yaser

+0

@YaserAdelMehraban如果一切都如它所見,我們應該承認,所有MS核心團隊在其他維度工作... –

回答

18

編輯csproj文件是這樣的:

<TargetFramework>netcoreapp1.1</TargetFramework> 

替換:

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

,並刪除:

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

然後

dotnet restore 
dotnet build 
dotnet run 

不要從包管理器控制檯運行dotnet run。它會起作用,但用(ctrl c)取消服務器是不可能的。

如果VS F5不起作用,(真爲VS 2017年RC,與yoman模板生成核心服務),然後改變:

<OutputType>winexe</OutputType> 

<OutputType>Exe</OutputType> 

,並重新啓動VS,重建是不夠的(啓用F5,VS 2017 RC爲真)。