I wrote this tutorial to help others understand how everything comes together from scratch by using the empty template; It’s not intended to be the quickest route.
If you’re looking for the quickest route, start with the Web API template which basically adds everything we added manually except for the Static Files library (this is added by default if you use .NET Core 2.0).
Create a new project folder, then, in Visual Studio Code, open that folder, open a Terminal via
[Backtick], then type:
dotnet new webapi
You’re almost done — add the code from the
Startup.cs example, scaffold the Angular app, change the
outDir parameter in the
.angular-cli.json to the relative path of your
wwwroot folder, add your
proxy.config.json and you’re done.
I usually create and scaffold the app using Visual Studio 2017 for a couple of reasons:
- When you initialize the git repository using VS, a fully fleshed out
.gitignoreis automatically generated so you don’t have to do it manually (e.g.
/**/obj, and anything that might show up, but shouldn’t be in source control)
- It is much quicker to configure Azure deployment from Visual Studio — once that’s done, your publishing profile will be generated and you can use the Azure CLI to deploy if you want.
However, I do use Visual Studio Code for daily development after I scaffold using Visual Studio because I prefer the lightweight environment for Angular.
My one question to you would be: Why are you using Gulp to move the files to the
/wwwroot directory instead of using
ng build with the
.angular-cli.json configured with the
outDir parameter? Seems unnecessary when you have the Angular CLI.