Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a new Angular project on Mac with Visual Studio

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?

like image 501
narner Avatar asked Jun 29 '17 17:06

narner


People also ask

How do I create a new Angular project in Visual Studio Code?

Now open Visual Studio Code. Go to "File" > "Open Folder" and select "First-Angular-Project" from the "Desktop". Now in the "TERMINAL" run ng new Angular-Project-Demo. Whenever it prompts with something like "Would you like to add Angular routing? (y/N)" press "y" and hit "ENTER".

Can you develop Angular in Visual Studio?

Using Angular in Visual Studio Code. Angular is a popular web development platform developed by Google. The Visual Studio Code editor supports Angular IntelliSense and code navigation out of the box.


2 Answers

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

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

enter image description here

Now create any SPA ...

dotnet new angular -o ngApp
cd .\ngApp\
npm install
dotnet restore
dotnet run
like image 169
Muhammad Rizwan Avatar answered Oct 05 '22 00:10

Muhammad Rizwan


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
like image 28
San Jaisy Avatar answered Oct 05 '22 02:10

San Jaisy