2017-06-29 81 views
2

我目前正在通過https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/WEB-103在Mac上設置Visual Studio中的Spa應用程序(macOS Sierra,Visual Studio Community 2017)。使用Visual Studio在Mac上創建一個新的Angular項目

我已經成功安裝了角度核心,並且正在嘗試根據其中一個安裝的模板創建一個新項目。

我可以看到兩個角模板當我運行sudo dotnet new -l

MVC ASP.NET Core with Angular angular [C#] Web/MVC/SPA ASP.NET Core with Angular angular [C#] Web/MVC/SPA

當運行sudo dotnet new angular,我不斷收到以下錯誤:

Unable to determine the desired template from the input template name: angular. 
The following templates partially match the input. Be more specific with the template name and/or language. 

Templates       Short Name  Language  Tags  
---------------------------------------------------------------------------- 
MVC ASP.NET Core with Angular  angular   [C#]   Web/MVC/SPA 
ASP.NET Core with Angular   angular   [C#]   Web/MVC/SPA 


Examples: 
    dotnet new angular 
    dotnet new angular 
    dotnet new --help 

有什麼在我的命令失蹤了? Visual Studio/dotnet配置不正確?

+0

你怎麼安裝模板?,做到這一點的方式是'dotnet new --install Microsoft.AspNetCore.SpaTemplates :: *' – Hackerman

+0

@Hackerman Yup!實際上,這正是我所做的。 – narner

+0

我們可以測試一件事情....我在想什麼是你的MAC中默認安裝的VS 2017,已經安裝了角模板...你可以做的是運行'dotnet new -u angular' ...然後檢查兩個模板都沒有了....然後再次使用'dotnet新安裝--install Microsoft.AspNetCore.SpaTemplates :: *' – Hackerman

回答

0

要安裝單頁應用(SPA)模板,運行以下命令:

dotnet new --install Microsoft.AspNetCore.SpaTemplates::* 

enter image description here

現在創建任何SPA ...

dotnet new angular -o ngApp 
cd .\ngApp\ 
npm install 
dotnet restore 
dotnet run 
+2

請留下@ PaulRoub的編輯,穆罕默德 - 這是一個很好的編輯。我們不鼓勵在這裏致敬,問候,簽字和簽名,如果這樣的編輯成爲編輯戰爭的主題,主持人往往更喜歡沒有他們的版本。 – halfer

相關問題