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:
|Implementing and Securing an API with ASP.NET Core (new)|
|Building a Web App with ASP.NET Core, MVC6, EF Core and AngularJS|
|Building a Web App with ASP.NET5, MVC6, EF7, and AngularJS (Retired)|
|Best Practices in ASP.NET: Entities, Validation, and View Models|
|Front-End Web Development Quick Start|
|Lessons from Real World .NET Code Reviews|
|Node.js for .NET Developers|
|Application Name||WilderBlog||Environment Name||Production|
|Application Ver||22.214.171.124||Runtime Framework||.NETCoreApp,Version=v1.1|
|App Path||D:\home\site\wwwroot||Runtime Version||.NET Core 4.6.25009.03|
|Operating System||Microsoft Windows 6.2.9200||Runtime Arch||X86|