使用Visual Studio在Mac上创建新的Angular项目 [英] Creating a new Angular project on Mac with Visual Studio

查看:286
本文介绍了使用Visual Studio在Mac上创建新的Angular项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在通过https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/WEB-103在Mac上使用Visual Studio设置Spa应用程序(macOS Sierra,Visual Studio Community 2017).

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.

运行sudo dotnet new -l时,我可以看到两个角度模板:

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

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时,出现以下错误:

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

命令中是否缺少某些内容? Visual Studio/dotnet的配置是否有误?

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

推荐答案

要安装单页应用程序(SPA)模板,请运行以下命令:

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

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

现在创建任何SPA ...

Now create any SPA ...

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

这篇关于使用Visual Studio在Mac上创建新的Angular项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆