Updates to ASP.NET 5 yeoman generators for beta 3

Jeffrey Fritz

Hi everyone, the blog post below is written by Shayne Boyer, who is a community member that has been working on the ASP.NET 5 yeoman generators. I hope you enjoy it. – Sayed

With the most recent version of Visual Studio 2015 CTP, CTP 6 this past Monday, there were some great improvements not only in the IDE but also ASP.NET 5. See the article here from Jeff Fritz, or Introducing ASP.NET 5 on Scott Guthrie’s blog, for even more. We have updated the ASP.NET 5 yeoman generators to have the latest content based on ASP.NET 5 beta 3. For more info on getting started with the generators see the two previous blog posts here; Yeoman generators for ASP.NET 5 and Adding New Items to Your ASP.NET 5 Project with Yeoman Subgenerators. In this post we will cover the updates to the generators which are now available.


KRE Version

This version of the generators are based on beta 3. You can use other version of the KRE but you may need to make changes to the content to build and run. To use beta 3 execute the command below:

kvm install 1.0.0-beta3 -p : installs and sets version to beta 3

By adding –p here next time the command prompt is opened beta 3 will be used.

Installing generator-aspnet

If you are getting the latest version, just run:

npm install -g generator-aspnet

If this is your initial installation you’ll need a few other things, see First Install below.

Now that you have installed the generators let’s move on to discuss the content of the generators.

New Project Templates

Visual Studio CTP 6 has reorganized the templates for ASP.NET 5 and now has 3 templates to choose from for a Web Application.


These new templates have been added to the generator for project scaffolding. There were existing Web, MVC, and Empty project samples in the generator; these have been replaced by the new templates and the Web API project has also been added.

Preview Starter Web

This is a great starter template; it’s responsive, has a bunch of links to resources on getting started, a nice carousel from bootstrap, how to use static content and more.

$yo aspnet

   |       |    .--------------------------.
   |--(o)--|    |      Welcome to the      |
  `---------´   |   marvellous ASP.NET 5   |
   ( _´U`_ )    |        generator!        |
   /___A___    '--------------------------'
    |  ~  |     
´   `  |° ´ Y ` 

? What type of application do you want to create? 
 Empty Application 
 Console Application 
❯ Web Application 
 Web API Application 
 Nancy ASP.NET Application 
 Class Library 

? What type of application do you want to create? Web Application
? What's the name of your ASP.NET application? (WebApplication) HelloWorldCTP6
  create HelloWorldCTP6/Startup.cs
  create HelloWorldCTP6/project.json
  create HelloWorldCTP6/package.json
  create HelloWorldCTP6/bower.json
  create HelloWorldCTP6/config.json
  create HelloWorldCTP6/gruntfile.js
  create HelloWorldCTP6/Models/AccountViewModels.cs
  create HelloWorldCTP6/Models/IdentityModels.cs
  create HelloWorldCTP6/Controllers/AccountController.cs
  create HelloWorldCTP6/Controllers/HomeController.cs
  create HelloWorldCTP6/Views/Home/Contact.cshtml
  create HelloWorldCTP6/Views/Home/About.cshtml
  create HelloWorldCTP6/Views/Home/Index.cshtml
  create HelloWorldCTP6/Views/Account/Login.cshtml
  create HelloWorldCTP6/Views/Account/Manage.cshtml
  create HelloWorldCTP6/Views/Account/Register.cshtml
  create HelloWorldCTP6/Views/Account/_ChangePasswordPartial.cshtml
  create HelloWorldCTP6/Views/Shared/Error.cshtml
  create HelloWorldCTP6/Views/Shared/_Layout.cshtml
  create HelloWorldCTP6/Views/Shared/_LoginPartial.cshtml
  create HelloWorldCTP6/Views/_ViewStart.cshtml
  create HelloWorldCTP6/wwwroot/_references.js

Your project is now created, you can use the following commands to get going
   kpm restore
   kpm build
   k run for console projects
   k kestrel or k web for web projects
The next commands you need to run are

$ kpm restore

This command restores all of the nuget packages and bower packages that are referenced in the project.

Next run

$ kpm build

to compile the application, then

$ k kestrel

to start the server, and browse to http://localhost:5004


As a note, for OSX/Linux/Unix based systems, Entity Framework functionality was commented out of the template but all of the files and code is included. When EF 7 is complete for cross platform (xplat) local development the generator templates will be updated. You do have the option of using Azure SQL if you intended or need to develop on non Windows platforms in the meantime.

Preview Empty Web

The Empty project is the same with a simple addition by comparison to the template in Visual Studio. The UseStaticFiles() and UseWelcomePage() functionality has been added by default in order give you some out of the box presentation.


Preview Web API

An out of the gate starter project template, one that was missing from the original ASP.NET 5 project types. This project template will give you the following greeting on the default page, and links to the built in values controller. http://localhost:5004/api/values.


Other Improvements

Previously the templates were hosted online, meaning the generator was reliant on an internet connection or subsequent repository in order to work.  This was a change in a recent version as well. Now all templates and content run locally. Yes you can even work on a plane, without having to spend $15.

The previous sample projects had hard coded namespaces such as “TestWeb” or “Application”, the new CTP 6 projects in the generator will now have your applicationName as the namespace.

All of the CTP 6 templates have been modified to add the Kestrel nuget package to support xplat development as well as the associated commands in the project.json file.

The Nancy Web API project has also been updated to point to the beta3 ASP.NET assemblies.

First Install

Node, npm, Yeoman

Everything the generator is using is based in one way or another on node.js, not to mention a majority of the tooling you’ll be using in the near future will be as well. Grunt, gulp, etc. So if you aren’t already using node, now is the time to get it.


Homebrew is the most efficient way of installing node, if you are not already using it, you can obtain it with the following command:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

John Papa has a great post on installing npm and node on OSX without sudo requirement here – http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/


Chocolately is the best way to obtain node.js for Windows. Install node via

choco install nodejs


Yeoman is the base generator package the ASP.NET generator is built on. You can install it from the command line or terminal with:

npm install -g yo

Finally you can install the ASP.NET generator

npm install -g generator-aspnet

What Missing?

Get involved, project is hosted on GitHub at omnisharp/generator-aspnet. There is a current issue here – https://github.com/OmniSharp/generator-aspnet/issues/66 , please comment; let us know what you need in a generator.

Shayne Boyer
@spboyer on twitter


Discussion is closed.

Feedback usabilla icon