Creating a new Angular project on Mac with Visual Studio

偶尔善良 提交于 2019-12-09 13:01:36

问题


I'm currently going through a https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/WEB-103 on setting up Spa apps with Visual Studio on Mac (macOS Sierra, Visual Studio Community 2017).

I've successfully installed angular core, and am currently trying to create a new project based off of one of the installed templates.

I can see two angular templates when I run 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

When running sudo dotnet new angular, I keep getting the following error:

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

Is there something in the command I'm missing? Is something with Visual Studio / dotnet configured incorrectly?


回答1:


To install the Single Page Application (SPA) templates, run the following command:

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

Now create any SPA ...

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



回答2:


With .netcore 2.1

dotnet new angular -o my-new-app
cd my-new-app

Now on 2.1 the package.json is inside client app

    cd ClientApp
    npm install
    dotnet restore
    dotnet run


来源:https://stackoverflow.com/questions/44831899/creating-a-new-angular-project-on-mac-with-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!