Solution: Merge dependent assemblies with ILMerge
If Template Builder is throwing such exception despite having the assemblies in the GAC, the recommendation would be to use of
ILMerge to make Template Building Blocks (TBBs) self-contained and prevent having to do additional, manual deployment actions on all Tridion Content Manager servers.
Here is an example of the procedure of combining the assemblies and including them in the post-build event of the project in
Visual Studio, just before the
TCMUploadAssembly.exe tool:
echo Performing ILMerge on output dll (including assembly1 and assembly2) "..\..\..\packages\ILMerge.3.0.41\tools\net452\ILMerge.exe" "$(TargetPath)" "$(TargetDir)assembly1.dll" "$(TargetDir)assembly2.dll" /out:"%TEMP%\$(TargetFileName)" /target:library /log echo Uploading dll and pdb to CMS "..\..\..\..\Tridion\TcmUploadAssembly.exe" /verbose /uploadpdb:true /targeturl:https://<CMEURL>/ "%TEMP%\$(TargetFileName)"
Once done, Template Builder should be able to run successfully the template.