Thursday, November 3, 2016

Create a clean ASP.NET MVC project

One thing I find annoying when creating a new ASP.NET MVC project is that the default templates are not well suited for my needs. You can take the MVC template but then you end up with a lot of extra stuff that you don’t need or you can choose the Empty template but then it is… too empty Confused smile.

image

I need to have something in between where I have the minimal set of boilerplate code without all the extra stuff added by the MVC template.

Here is a way how you can do this:

  • Start by creating a new ASP.NET project.
  • Choose the Empty template from the list of available templates. Click OK.

image

  • Once your new (empty) project is created, right click on the project in the Solution Explorer and choose Add –> New Scaffolded Item…

image

  • Choose MVC 5 Controller – Empty from the list and click on Add.

image

  • After the scaffolding is complete, you have a minimal set of starter code available…

image

Great tip from a colleague, thanks Koen!

No comments: