ASP.NET Core Snippets for Visual Studio Code
I’m currently creating a new course on how to use Visual Studio Code with ASP.NET Core. While I rely on yeoman for project scaffolding and some file scaffolding, I wanted to get some of the snippets I’ve grown used to having in the full Visual Studio.
I found a project called ASP.NET Core Snippets to my excitement, but it only had snippets for some of the main files in your project. Not action snippets or razor snippets. So at 4am last night I wrote a Visual Studio Code extension to add some of these snippets.
So far, it only has a handful of snippets that my 4am brain knew I wanted:
mvc6-action: Creates an MVC6 Action that returns a view.
mvc6-get: Creates an MVC6 Action that Implements a basic GET.
mvc6-post: Creates an MVC6 Action that Implements a basic POST.
mvc6-put: Creates an MVC6 Action that Implements a basic PUT.
mvc6-delete: Creates an MVC6 Action that Implements a basic DELETE.
mvc6-controller: Creates an MVC6 Controller for views.
mvc6-apicontroller: Creates an MVC6 Controller for an API that implements all four basic verbs.
ef-dbcontext: Creates an Entity Framework Core DbContext class.
razor-inject: Generates an @inject block.
razor-environment: Generates an environment block.
razor-raw: Generates an @Html.Raw block.
You can get the snippet from the marketplace here:
or by installing them directly in Visual Studio Core:
I’d love anyone that has snippets that would be helpful or knows a snippet they’d like me to build. Fork the repo and send me a pull-request, or just add an issue to the github repo: