Referencing an external DLL from your Tridion C# Compound TemplatesPosted by in Tridion 2011
In Tridion 2011 we have the opportunity to write C# templates with .NET 4.0. If you reference an external DLL or another Visual Studio project from your template project the DLL needs to be registered in the GAC. Follow this short guide to help you get started with registering your external DLLs to reference from your templates.
1. Sign the Assembly in Visual Studio if your external DLL is a Visual Studio project. Otherwise, you should generate an snk file for your existing external DLL.
2. Compile Project and copy the DLL to the Tridion Bin folder or another Folder on the CMS server.
3. Use Gacutil to register external DLL. If you have VS 2010 SP 1 installed it is located in ‘C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools’
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\gacutil.exe" /i file.dll
4. Verify it is in the GAC:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\gacutil.exe" /l > gac.txt
Open gac.txt in a text editor
5. Compile and Build the Compound Template to deploy the DLL Templates
6. Open Template Builder and Preview the Template. Use the Logger to write to the log file.