Skip to content
Howard van Rooijen By Howard van Rooijen Co-Founder
Introducing Templify

[Note: Templify 0.7.0.25 is now available]

In my last post I talked about the philosophy of "Work Smarter, Not Harder"; it's a very simple mantra that can be described in three simple steps:

Do, Recognise, Codify.

The Introduction to Rx.NET 2nd Edition (2024) Book, by Ian Griffiths & Lee Campbell, is now available to download for FREE.

This philosophy is at the very core of what we do at endjin so we decided to share the knowledge with the community by releasing, with an open source license, a series of tools and framework under the umbrella of "Work Smarter, Not Harder".

The first tool is called Templify and it aims to solve one simple problem and solve it well:

Every project starts the same way, You create a place to put Solution Artefacts On one file system On one computer

That's it. It's a simple problem. It's a process that developers all over the world will do hundreds of thousands of times a day. The real issue is that it's a wasteful process. Within the Microsoft ecosystem – it's a problem that really hasn't been solved because Microsoft (and in particular Visual Studio) believes that the story starts and ends within the IDE. You create a Project which automatically creates a wrapping solution – but you have no control over the solution structure. A new Visual Studio solution doesn't take into account best practices such as a branchable folder structure or how best to organise your referenced assemblies, where your automated build process should be located, or which oft reusable frameworks and tools you use in every project.

Templify elegantly solves the problem by recognising where the process actually starts – inside Windows Explorer. Templify has two modes – Create and Deploy. In Create mode you can take a pre-existing solution and turn it into a deployable template. You do this by first installing Templify, then navigating to the parent folder of the solution you want to Templify inside Windows Explorer. In the following example we are using the default assets from Sharp Architecture 1.6:

Next, right click on the folder and display the context menu. Select the "Templify This Folder" option:

templify-this-folder

This will launch the Templify UI, which will ask you to fill in the following details:

templify-this-folder-default-screen

In the token field you should enter the repeating token (the top namespace identifier)  that will be replaced with a new value when the package will be deployed. In the sample above the repeating token is "SA169" which is the top level namespace and solution name used within Sharp Architecture 1.6. Templify UI is built using Caliburn Micro and takes advantage of the convention based databinding and validation within that framework. For example until you enter values in all the required fields the "Templify" button will be disabled:

templify-this-folder-no-version-number-screen

But once you have entered a valid version number the "Templify" button is now enabled:

templify-this-folder-filled-in-screen

The create screen also allows you to manage which files and folders you want to exclude from the template package creation process – for example you would not like StyleCop.Cache files, .User files or bin and obj folders being included in your template as these are temporary build artefacts – or Git / SVN versioning folders.

templify-this-folder-manage-exclusions

Once you have entered all your settings you can click the "Templify" button and the templification process will begin. Progress is displayed via a progress bar and a status message telling which step is occurring:

templify-this-folder-templifying

Templify has the following steps:

Build Package File Manifest, Build Package, Clone Package, Tokenise Package Contents, Tokenise Package Structure, Creating Package Archive, Clean Up Temporary Files.

When the solution has been templified and turned into a package a toast will appear notifying you that the process has been successful. Packages are created at the following location:

C:\%USER%\AppData\Roaming\Endjin\Templify\repo

Programming C# 12 Book, by Ian Griffiths, published by O'Reilly Media, is now available to buy.

Packages are created using the wonderful 7Zip format but with an extension changed to .pkg. If you want to peek inside a package simply open it with 7Zip.

templify-this-folder-package-created-and-deployed

The second mode Templify supports is Deploy mode. In Windows Explorer, select an empty folder that you want to deploy your template to. Right click on the folder and select "Templify Here"

templify-here

This will spawn a new instance of Templify that knows about the folder you just highlighted. It will ask you to select a template and to enter the new name of your solution:

templify-here-default-screen

By default Templify ships with Sharp Architecture 1.6:

templify-here-available-packages

Again using Caliburn Micro's convention based validation – the deploy button is disabled until you complete all the fields:

templify-here-enter-name

templify-here-deploy-template

This screen also allows you to manage existing packages – by clicking on the "Manage Templates" button – which will spawn a dialog that will allow you to delete any of the packages within the repository

templify-here-manage-packages

Once you've clicked "Deploy Template" a progress bar will appear showing the progress of the steps Templify is going through to deploy the package (which are essentially the reverse of the Create mode):

Extract Files From Package, Tokenise Package Structure, Tokenise Package Contents, Clean Up Temporary Files.

templify-here-templifying

Once the package has been successfully deployed another toast will appear to notify you.

templifyhere-sucess-notification

And now you should be up and running with a complete customised version of your template, which contains an automated build, referenced assemblies, projects etc.

In future posts we'll cover using Templify from the command line, how you can integrate it into your CI process to automatically create a package as a build artefact.

Hopefully Templify will help you Work Smarter, Not Harder.

@HowardvRooijen | @endjin | @templify

Howard van Rooijen

Co-Founder

Howard van Rooijen

Howard spent 10 years as a technology consultant helping some of the UK's best known organisations work smarter, before founding endjin in 2010. He's a Microsoft ScaleUp Mentor, and a Microsoft MVP for Azure and Developer Technologies, and helps small teams achieve big things using data, AI and Microsoft Azure.