{"id":5611,"date":"2015-02-28T18:40:00","date_gmt":"2015-02-28T18:40:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2015\/02\/28\/updates-to-asp-net-5-yeoman-generators-for-beta-3\/"},"modified":"2015-02-28T18:40:00","modified_gmt":"2015-02-28T18:40:00","slug":"updates-to-asp-net-5-yeoman-generators-for-beta-3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/updates-to-asp-net-5-yeoman-generators-for-beta-3\/","title":{"rendered":"Updates to ASP.NET 5 yeoman generators for beta 3"},"content":{"rendered":"<p>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. &#8211; <a href=\"https:\/\/twitter.com\/sayedihashimi\">Sayed<\/a><\/p>\n<p>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 <a href=\"http:\/\/blogs.msdn.com\/b\/webdev\/archive\/2015\/02\/23\/aspnet-5-updates-for-feb-2015.aspx\">here<\/a> from Jeff Fritz, or <a href=\"https:\/\/weblogs.asp.net\/scottgu\/introducing-asp-net-5\">Introducing ASP.NET 5<\/a> on Scott Guthrie&rsquo;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; <a href=\"http:\/\/blogs.msdn.com\/b\/webdev\/archive\/2014\/12\/17\/yeoman-generators-for-asp-net-vnext.aspx\">Yeoman generators for ASP.NET 5 <\/a>and <a href=\"http:\/\/blogs.msdn.com\/b\/webdev\/archive\/2014\/12\/17\/adding-new-items-to-your-asp-net-5-project-with-yeoman-subgenerators.aspx\">Adding New Items to Your ASP.NET 5 Project with Yeoman Subgenerators<\/a>. In this post we will cover the updates to the generators which are now available.<\/p>\n<h4>Prerequisites<\/h4>\n<h5>KRE Version<\/h5>\n<p>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:<\/p>\n<p><span style=\"font-family: Consolas\">kvm install 1.0.0-beta3 -p<\/span> : installs and sets version to beta 3<\/p>\n<p>By adding <span style=\"font-family: Consolas\">&ndash;p<\/span> here next time the command prompt is opened beta 3 will be used.<\/p>\n<h5>Installing generator-aspnet<\/h5>\n<p>If you are getting the latest version, just run:<\/p>\n<pre class=\"brush: bash;\"><span style=\"font-family: 'courier new', courier\">npm install -g generator-aspnet<\/span><\/pre>\n<p>If this is your initial installation you&rsquo;ll need a few other things, see <a href=\"#FirstInstall\">First Install<\/a> below.<\/p>\n<p>Now that you have installed the generators let&rsquo;s move on to discuss the content of the generators.<\/p>\n<h4>New Project Templates<\/h4>\n<p>Visual Studio CTP 6 has reorganized the templates for ASP.NET 5 and now has 3 templates to choose from for a Web Application.<\/p>\n<p><a href=\"https:\/\/dl.dropboxusercontent.com\/u\/40134810\/blog\/webdevblog\/yeoman.2015.02\/project_templates_vs2015.png\"><img decoding=\"async\" title=\"project_templates_vs2015[1]\" src=\"\" alt=\"project_templates_vs2015[1]\" width=\"550\" height=\"322\" border=\"0\" \/><\/a><\/p>\n<p>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.<\/p>\n<h5>Preview Starter Web<\/h5>\n<p>This is a great starter template; it&rsquo;s responsive, has a bunch of links to resources on getting started, a nice carousel from bootstrap, how to use static content and more.<\/p>\n<pre class=\"brush: bash;\">$yo aspnet\n\n    _-----_\n   |       |    .--------------------------.\n   |--(o)--|    |      Welcome to the      |\n  `---------&acute;   |   marvellous ASP.NET 5   |\n   ( _&acute;U`_ )    |        generator!        |\n   \/___A___    '--------------------------'\n    |  ~  |     \n  __'.___.'__   \n&acute;   `  |&deg; &acute; Y ` \n\n? What type of application do you want to create? \n Empty Application \n Console Application \n\u276f Web Application \n Web API Application \n Nancy ASP.NET Application \n Class Library \n\n? What type of application do you want to create? Web Application\n? What's the name of your ASP.NET application? (WebApplication) HelloWorldCTP6\n  create HelloWorldCTP6\/Startup.cs\n  create HelloWorldCTP6\/project.json\n  create HelloWorldCTP6\/package.json\n  create HelloWorldCTP6\/bower.json\n  create HelloWorldCTP6\/config.json\n  create HelloWorldCTP6\/gruntfile.js\n  create HelloWorldCTP6\/Models\/AccountViewModels.cs\n  create HelloWorldCTP6\/Models\/IdentityModels.cs\n  create HelloWorldCTP6\/Controllers\/AccountController.cs\n  create HelloWorldCTP6\/Controllers\/HomeController.cs\n  ...\n  create HelloWorldCTP6\/Views\/Home\/Contact.cshtml\n  create HelloWorldCTP6\/Views\/Home\/About.cshtml\n  create HelloWorldCTP6\/Views\/Home\/Index.cshtml\n  create HelloWorldCTP6\/Views\/Account\/Login.cshtml\n  create HelloWorldCTP6\/Views\/Account\/Manage.cshtml\n  create HelloWorldCTP6\/Views\/Account\/Register.cshtml\n  create HelloWorldCTP6\/Views\/Account\/_ChangePasswordPartial.cshtml\n  create HelloWorldCTP6\/Views\/Shared\/Error.cshtml\n  create HelloWorldCTP6\/Views\/Shared\/_Layout.cshtml\n  create HelloWorldCTP6\/Views\/Shared\/_LoginPartial.cshtml\n  create HelloWorldCTP6\/Views\/_ViewStart.cshtml\n  create HelloWorldCTP6\/wwwroot\/_references.js\n  .\n  .\n  .\n\nYour project is now created, you can use the following commands to get going\n   kpm restore\n   kpm build\n   k run for console projects\n   k kestrel or k web for web projects<\/pre>\n<pre class=\"brush: bash;\">The next commands you need to run are<\/pre>\n<p><span style=\"font-family: Consolas\">$ kpm restore<\/span><\/p>\n<p>This command restores all of the nuget packages and bower packages that are referenced in the project.<\/p>\n<p>Next run<\/p>\n<p><span style=\"font-family: Consolas\">$ kpm build<\/span><\/p>\n<p>to compile the application, then<\/p>\n<p><span style=\"font-family: Consolas\">$ k kestrel<\/span><\/p>\n<p>to start the server, and browse to http:\/\/localhost:5004<\/p>\n<p><a href=\"https:\/\/dl.dropboxusercontent.com\/u\/40134810\/blog\/webdevblog\/yeoman.2015.02\/web_template_running.png\"><img decoding=\"async\" title=\"web_template_running\" src=\"\" alt=\"web_template_running\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>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 (<em>xplat<\/em>) 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.<strong><\/strong><\/p>\n<p><strong>Preview Empty Web<\/strong><strong><\/strong><\/p>\n<p>The Empty project is the same with a simple addition by comparison to the template in Visual Studio. The <em>UseStaticFiles() <\/em>and <em>UseWelcomePage()<\/em> functionality has been added by default in order give you some out of the box presentation.<\/p>\n<p><a href=\"https:\/\/dl.dropboxusercontent.com\/u\/40134810\/blog\/webdevblog\/yeoman.2015.02\/empty_template_welcome_page.png\"><img decoding=\"async\" title=\"empty_template_welcome_page\" src=\"\" alt=\"empty_template_welcome_page\" width=\"640\" height=\"467\" border=\"0\" \/><\/a><\/p>\n<p><strong>Preview Web API <\/strong><strong><\/strong><\/p>\n<p>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.<\/p>\n<p><a href=\"https:\/\/dl.dropboxusercontent.com\/u\/40134810\/blog\/webdevblog\/yeoman.2015.02\/webapi_default_screen.jpg\"><img decoding=\"async\" title=\"webapi_default_screen\" src=\"\" alt=\"webapi_default_screen\" width=\"586\" height=\"65\" border=\"0\" \/><\/a><\/p>\n<p><strong>Other Improvements<\/strong><strong><\/strong><\/p>\n<p>Previously the templates were hosted online, meaning the generator was reliant on an internet connection or subsequent repository in order to work.&nbsp; 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.<\/p>\n<p>The previous sample projects had hard coded namespaces such as &ldquo;TestWeb&rdquo; or &ldquo;Application&rdquo;, the new CTP 6 projects in the generator will now have your <em>applicationName <\/em>as the namespace.<\/p>\n<p>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.<\/p>\n<p>The Nancy Web API project has also been updated to point to the beta3 ASP.NET assemblies.<\/p>\n<p><a name=\"FirstInstall\"><\/a><strong>First Install<\/strong><\/p>\n<p><strong>Node, npm, Yeoman<\/strong><strong><\/strong><\/p>\n<p>Everything the generator is using is based in one way or another on node.js, not to mention a majority of the tooling you&rsquo;ll be using in the near future will be as well. Grunt, gulp, etc. So if you aren&rsquo;t already using node, now is the time to get it.<\/p>\n<p><strong>OSX<\/strong><strong><\/strong><\/p>\n<p>Homebrew is the most efficient way of installing node, if you are not already using it, you can obtain it with the following command:<\/p>\n<p><span style=\"font-family: Consolas\">ruby -e &#8220;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)&#8221;<\/span><\/p>\n<p>John Papa has a great post on installing npm and node on OSX without sudo requirement here &#8211; <a href=\"http:\/\/www.johnpapa.net\/how-to-use-npm-global-without-sudo-on-osx\/\">http:\/\/www.johnpapa.net\/how-to-use-npm-global-without-sudo-on-osx\/<\/a><\/p>\n<p><strong>Windows<\/strong><strong><\/strong><\/p>\n<p><a href=\"https:\/\/chocolatey.org\/\">Chocolately<\/a> is the best way to obtain node.js for Windows. Install node via<\/p>\n<p><span style=\"font-family: Consolas\">choco install nodejs<\/span><\/p>\n<p><strong>Yeoman<\/strong><strong><\/strong><\/p>\n<p>Yeoman is the base generator package the ASP.NET generator is built on. You can install it from the command line or terminal with:<\/p>\n<p><span style=\"font-family: Consolas\">npm install -g yo<\/span><\/p>\n<p>Finally you can install the ASP.NET generator<\/p>\n<p><span style=\"font-family: Consolas\">npm install -g generator-aspnet<\/span><\/p>\n<p><strong>What Missing?<\/strong><strong><\/strong><\/p>\n<p>Get involved, project is hosted on GitHub at <a href=\"https:\/\/github.com\/OmniSharp\/generator-aspnet\">omnisharp\/generator-aspnet<\/a>. There is a current issue here &#8211; <a href=\"https:\/\/github.com\/OmniSharp\/generator-aspnet\/issues\/66\">https:\/\/github.com\/OmniSharp\/generator-aspnet\/issues\/66<\/a> , please comment; let us know what you need in a generator.<\/p>\n<p>Shayne Boyer <br \/><a href=\"http:\/\/www.twitter.com\/spboyer\">@spboyer<\/a> on twitter <br \/><a href=\"http:\/\/www.tattoocoder.com\/\">http:\/\/www.tattoocoder.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. &#8211; Sayed With the most recent version of Visual Studio 2015 CTP, CTP 6 this past Monday, there were some great improvements not only [&hellip;]<\/p>\n","protected":false},"author":405,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7489],"class_list":["post-5611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net-5"],"acf":[],"blog_post_summary":"<p>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. &#8211; Sayed With the most recent version of Visual Studio 2015 CTP, CTP 6 this past Monday, there were some great improvements not only [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/5611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/405"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=5611"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/5611\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=5611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=5611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=5611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}