SideWaffle: How to create your own VS template pack
If you haven’t heard I’m working on a project with Mads Kristensen called SideWaffle. SideWaffle is a Visual Studio Extension which contains many different Visual Studio Item and Project Templates. This is a community effort and all open source at https://github.com/ligershark/template-builder. You can create your own Item Templates and Project Templates and send a Pull Request for them to be included in the main repo. Check out the video below for more info on SideWaffle.
SideWaffle intro video
Item Templates are used by VS developers to create files using the Add New Item dialog. SideWaffle already contains a number of Item Templates such as; Angular Controller, robots.txt, SignalR Hub and Client, etc. For more info on how to create Item Templates with SideWaffle watch the 4 minute video below.
Project Templates are the items that show up in the Add New Project dialog. They provide a starting point for developers creating new projects. SideWaffle already has a few project templates as well, such as a Google Chrome Extension. You can learn more about how to create Project Templates in this video.
Now that we’ve gotten the intro out of the way, let’s explore how you can create your own SideWaffle.
How to create your own SideWaffle
The idea behind SideWaffle is that we will have a shared VS extension for popular VS Item and Project Templates. Instead of contributing to the main SideWaffle project you may be interested in creating your own distribution that does not have the standard templates. For example, I’ve heard from both the Orchard and Umbraco that they are interested in creating template packs for their communities. It wouldn’t make much sense to include those templates in the main SideWaffle project. Instead it would be best to create a separate distribution for each; OrchardWaffle and UmbracoWaffle.
So how can you do this? It’s pretty easy actually. SideWaffle is built on top of a NuGet package, TemplateBuilder, which is also open source at https://github.com/ligershark/template-builder. All the core functionality of SideWaffle is contained in that NuGet package. To create your own SideWaffle follow these steps:
- If you don’t have it already download and install the Visual Studio SDK, here is 2012 version
- Create a new Visual Studio Package project
- From the package manager console execute Install-Package TemplateBuilder –pre
After you add the TemplateBuilder NuGet package a few things happen:
- The build process of the project is modified to support building Item and Project templates
- Your .vsixmanifest file is updated with two new Asset tags
- An ItemTemplates folder is created with a sample Item Template
From here on you can build the project and after installing the generated .vsix you can have users easily create instances of your item or project templates.
You can add additional Item Templates, as well as create Project Templates in your project. That’s pretty much all there is to getting started with your own Waffle pack.
Let me know if you have any issues or comments.
Sayed Ibrahim Hashimi | http://msbuildbook.com | @SayedIHashimi