How to upgrade Compound Template DLLs that reference DD4T via the GAC

Recently I performed an upgrade of an SDL Tridion 2011 SP1 HR1 implementation to SDL Tridion 2013 SP1. I have learned a lot of little tricks that I will share on this blog.

The website was a single web publication with only one language which simplified things a lot. The project was implemented with DD4T 1.31. It used a custom TBB which referenced DD4T’s templating DLLs. These need to be installed in the GAC (Global Assembly Cache) if you need to extend DD4T’s default templating functionality. This is required because DD4T’s templates are installed as a merged DLL. This is done using the ILMerge tool. Unfortunately this means you cannot depend on this DLL in your own TBBs.

Generally you will have your own custom TBB DLL in addition to the DD4T templates which contaion Template Building Blocks to perofrm additional, non-DD4T templating such as publishing Sitemap XML or resolving of custom binaries. So in order to utilise the DD4T content model you need to reference the DD4T.ContentModel DLL which is merged into the DD4T templates. For this reason you need to install these DLLs into the GAC.

In an upgrade scenario, your custom templating DLL will reference DD4T 1.31 from the GAC. This caused an interesting problem for us because this was not an in-place upgrade, we were moving the customer onto a new Windows Azure based infrastructure which meant entirely new servers. So, no DD4T DLLs were in the GAC.

We recompiled our custom templates against the new Tridion Content Delivery DLLs and against the new DD4T Templating DLLs and tried to upload them using SDL’s TcmUploadAssembly tool. This resulted in a reference error because the TcmUploadAssembly tool seemed to require the DD4T 1.25 DLLs to be in the GAC (our templates were out of sync with the version of DD4T used in the web app).

I wanted to automate this upload since I had 3 Content Manager servers to upgrade and I also would need to do this when we did a  content sync from production as preparation for go-live. I figured out that in order to upload the newly recompiled custom TBB DLL to Tridion I would need both the 1.25 DLLs and the 1.31 DLLs to be in the GAC.

So I wrote a Powershell script which install the 1.25 and 1.31 DLLs into the GAC, uploaded the TBBs and then removed the 1.25 DLLs afterwards.

 

Now I can run this any time the 2011 Content Manager database was restored and upgraded. This seemed to work pretty well and I hope it helps someone else.


Leave a Reply

Your email address will not be published. Required fields are marked *