There is a newer updated blog for this here.
The kre home is being renamed again. I will update these posts that referred to the new .dotnet home for runtime as that appears to be going away.
Ok, let’s do what we set out to do, create an app from scratch using the tooling provided by ASP.NET 5.
Make sure you have looked at Part 1 of this series, Part 1.
Starting from the command window we set up last time, type
Let’s create a Home MVC 6 controller.
k gen controller -name Home -scripts -udl
We will see a lot happen to our once “empty” project.
Notice the comment at end of run to check the ScaffoldingReadMe.txt file. That tells us to add some things to our Startup class which we will do shortly.
A look at our project now shows a lot has been added.
"Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*"
Let’s add an Index view for our Home controller under Views\Home folder creating the Home sub-folder first. Let the view have this for content.
ViewBag.Title = “Home Page”;
Layout = “~/Views/Shared/_Layout.cshtml”;
<h2>FromScratchWebApp – The Web made easy</h2>
Ok, one more step and we can run. Remember the file output for us, ScaffoldingReadMe.txt? It tells us exactly what to put in our Startup class.
Replace the contents of Configure method that we had added with what is in the file.
Add the using directives provided to the top of the file as well.
We are done. Build the app making sure there are no build errors.
Not bad for doing almost no coding ourselves.
Next, we unleash the power of the
k ef commmand.