Templify and NuGet Synergy

Jan 5, 2011 at 8:37 AM


a few months ago I created an OSS tool called Templify, which tries to solve a problem that is parallel to NuGet: every project starts the same way: you create a place to put solution artefacts,on one file system, on one computer. Templify helps you work smart, not hard by reducing repetition.

Templify allows you to create a "master" solution which you can then "Templify" to create a reusable tokenized package which be distributed. From within Windows Explorer you can select any new folder and "Templify" it, which unfurls and re-tokenised the package, leaving you with a new solution with a new name and namespace. It's basically a way of achieving Enterprise Templates in 2010.

It was originally created as a deployment mechanism for Sharp Architecture, which is a best practice Web Architecture using MVC, NHibernate and Fluent NHibernate - where the re-distributable is a solution rather than a set of assemblies.

You can find a more detailed introduction here: http://blog.endjin.com/2010/10/introducing-templify/ project homepage is at http://opensource.endjin.com/templify/ and source is available at https://github.com/endjin/Templify

At the moment when you Templify a folder a 7Zip package is created and stored in Templify's local file based repo - which is located at C:\%USER%\AppData\Roaming\Endjin\Templify\repo - one of the things I've been thinking of adding as a new feature is a cloud based repo that will allows people to share their Templify packages - I was wondering if there was any scope for integrating with the NuGet infrastructure / processes?


@HowardvRooijen | @templify


Jan 5, 2011 at 9:06 AM

I'll try to write a spec story :-)

Story: A repository of "solution expansions" via Templify and NuGet

As a developer, I want to
  start with any solution template or start with a Templify solution template
  right click the solution and select 'add expansion'
  browse a list of possible expansions for the current solution
  click 'deploy' and have Templify & NuGet install an expansion over the solution

The nuance here is that it should work on a solution level opposed to a project level. This means that when I create an ASP.NET MVC application, I can "Templify" Sharp Architecture on top of it where multiple projects are added and configurations & references can be updated. I'll give you another scenario:

I start with an ASP.NET MVC application. I want to create a layered application, so I select 'add expansion' and pick a 'layered application' package. This one adds some projects to the solution: a DB layer, a business layer, a service layer, a WCF host, ... Maybe I want NHibernate with that? I click 'add expansion', select NHibernate and a package reference to NHibernate is added, as well as a Session module for NHibernate in the MVC project.

I realize that this is a tough one, but it would automate a huge amount of my daily woes when setting up new projects at customers. Hell, I could even go there for a day and let NuGet / Templify do my work while I get paid all day.

Jan 5, 2011 at 12:41 PM
We have something similar called WarmuP. You can share your templates because they are in source control.

We have discussed how we would bring the idea of NuGet into it as well. For us, it might be more of the way solution factory has been changed to use NuGet and powershell to recreate a project.

Although warmup brings code and everything with it before it replaces the tokens so you have an entire set of working infrastructure ready to rock out your business cases.
Jan 5, 2011 at 12:50 PM

I did actually look at WarmUp prior to building Templify but ended up going in a slightly different direction.

Originally we discussed using a standard RSS feed + enclosures for distributing / subscribing to Templify packages - but if NuGet already has a similar / centralised infrastructure - that could be very useful to the community.

Adding NuGet support inside a template would also be very useful - especially for something like Sharp Architecture which take dependencies on dozens of OSS libraries.


@HowardvRooijen | @templify

Jan 5, 2011 at 1:15 PM

The golden rule for us is maintenance. How do you update your templates? We do it like a regular project because we use source control.

For all of the chucknorris projects, the idea is the least amount of pain in maintenance for a dev.

Thats why we stayed away from vsix or things that needed zipped up: updating template stuff would be a bear. Having it in source control allows me to just update it and move on.

Each template is a diff section in source or a diff source. And because it's in source, it's already available "in the cloud."

I'm sorry to hear it didn't work for your needs, but perhaps you could use some of it's ideas to ease you're maintenance pain as you move forward with templify.
"Be passionate in all you do"


Jan 5, 2011 at 1:34 PM

And that's the reason for the difference in direction - Sharp Architecture isn't just source code - it's the output of a CI Build that we need to ship. Building a templify package is not an issue because it's got command line / msbuild support out of the box

Plus there's a distribution issue as we're trying to get this product out to 1000s of users not all of whom can access source control protocols thru their firewalls.

The prototype we've got working just consumes a TeamCity sucessful build rss feed - this works well for the Sharp Arch Dev Team (as we have a TC Build Server) - but NuGet infrastructure offers a means of extensibility for all other users who want to publish and share their own templates.

I was sorry it didn't quite work out - WarmUp looked very promising - but just didn't quite fit :(


@HowardvRooijen | @templify

Jan 5, 2011 at 1:50 PM
Now I am grokking the difference. That sounds pretty sweet. From the sound of things, have you considered building an interface for Templify that integrates with the gallery that could deliver the entire solution down?
"Be passionate in all you do"

Jan 7, 2011 at 10:52 AM

I blogged on both tools: Tools for the lazy: Templify and NuGet --> http://bit.ly/egVveZ

Jan 11, 2011 at 1:32 AM

Synergy can be looked at a different levels.

First, you should be able to create Templify templates that contain installed nuget packages, e.g.

  • Write a solution, using nuget in various projects
  • Templify the solution
  • Create a new solution from the template

At this point, the new solution should have all the proper nuget references, which means that things like package updates should just work (note: I tried it and it didn't work.  Looks like Templify is corrupting the nupkg files).

Then there is the potential to align the cloud story, which I guess is more the angle that you had.  Though in a sense, it feels like Templify templates are much more similar to VS project templates than to nuget packages.  In many ways, they're just multi-project templates.  So I wonder if there is also some possible convergence at that level.

Jan 11, 2011 at 9:56 AM

Good point on the VS project templates.

Jan 11, 2011 at 10:07 AM

Thanks for your thoughts - I'll take a look at why it's corrupting nupkg files - that should be an easy fix.

Templify is a little bit like VS Project Templates - but Templifie exists for creating whole solutions, which contain automated builds, referenced assemblies, tools, common files, packages which live "above" normal VS Projects. The limitations with VS Project Templates (and any form of VS Solution Automation whether that be GAT / Blueprint / VS Project Templates) is that they operate at the project level - rather than the solution as a whole.

Mar 21, 2011 at 5:47 PM

It's probably corrupting nupkg files for the same reason warmup was (I just noticed today). It inspects the file, which changes it. Do you have extensions to ignore or something of this nature?

Mar 21, 2011 at 11:33 PM

I did push a file exclusion to ignore *.nupkg files: https://github.com/endjin/Templify

Jun 5, 2011 at 9:06 PM

I've just released an updated version of templify with better file exclusion support.


This was done to enable nuget support in Sharp Architecture v2.0