Writing this blog post is like sharing an experience about Making a Hollywood movie or talking about behind the scenes for a Hollywood movie, working with Sitecore is a different experience and that is what I am sharing here and as the title says “Making of Sitecore Community Project Templates” is what this post is all about.
This all started with one bright idea from Varun Shringarpure and he was the lone warrior while he initiated his idea into a working copy. I saw him working on this great idea and suggested to help, Varun had some different idea and wanted to work alone. A couple of weeks later Varun wanted me to be part of it and he shared his experience and findings with me. Finally working together for another couple of weeks we were able to release it for Sitecore Community.
Varun started creating the various projects and their structure he followed the approach suggested at Side Waffel. There were lot of configuration needed to be done for us to get the templates generated based on Side Waffel. Later on digging into further it was discovered that there is much easier way to create the visual studio templates and we completely dropped the idea of using Side Waffel.
The approach we followed was to export each visual studio project as a template, zip the exported template and add them to the VSIX project solution. A manual task but much simpler and easier task as compared to Side Waffel configuration. Also it was difficult to troubleshoot the configurations that we created for Side Waffel.
Varun announced the release of Sitecore Community Project Templates, more on the documentation and source can be found by following the link.
If you are interested in knowing more about how it is all setup and few tips if you want to come up with your own visual studio templates keeping reading further as this will help to get you kick-started.
How is it all setup?
Currently we have setup three solutions,
Solution for creating the VSIX file that references templates from other projects.
Solution containing a bunch of projects required to setup a Sitecore MVC solution.
Solution containing a bunch of projects required to setup a Sitecore Webforms solution.
Creating Visual Studio Project Templates
Firstly we created projects structure for all projects Sitecore.MVC.Extension, Sitecore.MVC.IOC, Sitecore.MVC.Models, Sitecore.MVC.Services, Sitecore.MVC.TDS.Core, Sitecore.MVC.TDS.Master, Sitecore.MVC.Web and Sitecore.MVC.Web.UnitTest. For the projects we Added and removed files, installed nugets and such kind of stuff.
Once we had our projects setup correctly we did Export Template for each of the projects in the solution which in the background created a .zip file for being used as a visual studio project template.
Creating VSIX Project
Next step was to create a VSIX project that would help us to deliver the Sitecore Community Project Templates.
This is how we setup the VSIX project,
You might think why did we created the structure ProjectTemplates/CSharp/Sitecore Community and then added all our project template zips. There’s a reason to do so as we wanted the templates to appear under Templates-> Visual C# and just above Sitecore Rocks.
Why it’s named Sitecore Community Project Templates?
We discussed few different names like Sitecore Templates (we dropped this name as would like Sitecore owns it), Sitecore R&D Templates, Sitecore Project Templates then came the final name Sitecore Community Project Templates as it was dedicated to the so awesome and vibrant Sitecore Community and anyone can contribute to it.
Releasing Sitecore Community Project Templates
Few things that Varun worked upon for releasing it to the Visual Studio Gallery were creating Readme.txt and it’s content, License.txt, Icons, pushing to github, Adding to Sitecore Marketplace and finally sending it to Visual Studio Gallery.
1) Amending project zip files with $safeprojectname$ helped us to achieve the custom project name that one can specify during new project creation.
Watch out this link for more token replacements at Template Parameters
2) For your project template to appear at a required location in the New Project Dialogue, the VSIX project should reflect the same folder structure and the zip of the project template should then be added to the required folder.
3) In order to support your VSIX for different versions of Visual Studio, open .vsixmanifest file -> Install Targets and Edit or Add New entry for the Visual Studio Version.
More details for inclusion and exclusion of visual studio versions can be found at VSIX Manifest Designer
5) Unzip exported template and rename project with $safeprojectname$
What a nice journey to cherish for, Thanks Varun for this endeavor and Pranav Geria for helping out with the Sitecore Icons.