2017-06-29 160 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

相关问题