Skip to main content
Why Yeoman for ASP.NET 5 applications?

Why Yeoman for ASP.NET 5 applications?

While learning .NET 5, I read that Yeoman now supports ASP.NET 5 application and it’s actually surprised me. And the first very thought came to my mind was “WHY?”

Why Yeoman for ASP.NET 5 applications?

Before we get to our topic, let’s understand about yeoman.

What is Yeoman?

Yeoman is, as per their official tagline Yeoman is “The web’s scaffolding tool for modern webapps”. And they are spot on with this. So let me put this in simple language what Yeoman can do for you. Yeoman can provide you a project structure, prescribing best practices, manage your dependencies and tools to help you stay productive. For example, if you are new to web application development and you have no idea about structure of your web app, best practices and required tools and dependencies. Well in such scenario, Yeoman is great help.

Yeoman recommends a workflow to improve your productivity and reduce your development time. The workflow is composed of three tools: yo (a scaffolding tool), Grunt/Gulp (A JavaScript task runner and a build tool) and Bower a package manager (alternatives are available).

To start with first install all Yeoman workflow tools using npm .

 npm install -g yo bower grunt-cli gulp 

Read following articles for better understanding about grunt and gulp.

Now, you also need to install a generator. Generator is going to help you get your project structure and all dependencies. And for every language/framework/Application, there is a separate generator. Like for angular js application there is angular generator and for jQuery application, there is jQuery generator. For this post, we will be installing webapp generator, which is the default web application generator that will scaffold out a project containing HTML5 Boilerplate, jQuery, and Grunt. You can get list of all Yeoman generators here.

 npm install -g generator-webapp 

Now, let’s create our webapp.

 
mkdir YoFirstWebApp // To create a new directory.
yo webapp 

And you should see following screen. And read the message “Out of box I include HTML5 Boilerplate, jQuery and a gruntfile to build you app”.

Creating webapp using Yeoman

And it is also prompting you to include SASS, Bootstrap and Modernizr. Select using space and hit enter. You should following screen where it is loading dependencies.

Creating webapp using Yeoman Loading dependencies

Once everything completed, your web application is ready. That’s really wonderful stuff. Isn’t it? Here are some articles on “How to use and start with Yeoman” which you can go through to learn more about Yeoman.

Let’s get back to our topic “Why Yeoman for ASP.NET 5 applications?

Yeoman also has generator-aspnet to scaffold your ASP.NET projects. I will not be going to in detail about how to install and use it for asp.net application. You should read “Building Projects with Yeoman”.Please read the article, before going down.

I assume that you have read the post. Now the question is that whatever asp.net web application structure is created using yo, can also be created using,
Visual Studio 2015 -> New Project -> ASP.Net web application.

We all know how powerful editor is Visual Studio is. In fact it’s not an editor, it’s an IDE (Integrated development environment). When I can get the same thing done via Visual Studio 2015 then why to use “Yeoman for ASP.NET applications?” To address this, one can give following argument.

  • It’s useful for front-end developers/UI developers who are not familiar with ASP.NET. But then again visual studio can do the same job for you.

That’s fine. But there still has to be concrete reason for this. Well, the reason is that we all are aware that .NET 5 is cross platform which means it works on windows, linux and macintosh machines. And the bad news is that “Visual studio 2015 works only on windows machines.” So for building ASP.NET applications on other than windows platform, developers use Visual Studio Code. And VS code is just an editor and it’s not as powerful as Visual studio 2015. You should read “What is Visual Studio Code and how it is different from Visual Studio 2015.

VS Code is file and folder based as compared to Visual Studio, which is project or solution based. You don’t open a solution in VS Code, you simply open a folder and if a supported project exists we will load it. You don’t get options like create new website or application with VS Code. And that’s why Yeoman comes in picture.

To summarize this, Yeoman with ASP.NET provides ASP.NET web application project scaffolding. And it may not be useful on windows as Visual Studio 2015 can perform the same job. But other than windows platform, Yeoman is the only option to build ASP.NET application. Yeoman is pretty handy on Linux and Mac or even on Windows if you don’t want to use Visual Studio. And that’s answer “Why Yeoman for ASP.NET 5 applications?

If you know any other reason than this, please write your feedback in comments section. I will update the article accordingly. Meanwhile, share this in your network.

Leave a Reply

Your email address will not be published. Required fields are marked *

16 + twelve =