Just following the code in "Learning ASP.NET Core 2"
- Download visual studio code (not using visual studio)
- Install .NET Core 2.1 [https://www.microsoft.com/net/download/archives]
- Make an empty repo and clone it
- CD into repo
- type
dotnet new web - type
code . - open
Program.cs(in code) - Choose to download prerquisits when the toast notification appears
- Hit
F5to run, see the webpage with "Hello, World!" - Change code to look like this (so we don't get IIS, we only listen for localhost and we remember how to do the CaptureStartupErrors thing)
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
//.CaptureStartupErrors(true)
.UseUrls("http://localhost:5000");- You probably want to add
WebHost.CaptureStartupErrors(true)at some point (WebHostis what you get from theBuildmethod odIWebHostBuilder) - Follow the Tut for a while.
- When it tells you to use Visual Studio to add a layout file, you are stuck. If you create a new project with .NET like this
dotnet new mvc --name AspNetMvcthe result will have a _Layout.cshtml file that you can use. - Also get the Home/Index.cshtml
- Just skip the bower stuff and use the CDN in development and production