Referencing Tridion DLLS: Quick Tip

dll_file_37106
Just sharing some advise on referencing your SDL Tridion DLLs from a centralised location.

 

Scenario
I grabbed code out of SVN for an existing Custom Resolver, made some updates then compiled and deployed to the GAC on the client’s development environment.

Publishing now gave an error:

Could not load file or assembly 'Tridion.ContentManager.Publishing, Version=7.0.0.2303, Culture=neutral, PublicKeyToken=360aac4d3354074b' or one of its dependencies. The system cannot find the file specified.

Upon decompilation of both the original and my new custom resolver DLLs I found that the original had been built against Tridion DLLs of version 6.1.0.996 (Tridion 2011) and my new one against Tridion DLLs of version 7.0.0.2303 (Tridion 2013). Of course I was going to get an error because my client is running 2011 and my compiled DLL had been built against 2013.

But how had I built the custom resolver against 2013 DLLs without realising?

Turns out that the original developer had stored the Tridion 2011 DLLs in a centralised folder within SVN to which they were referencing within the custom resolver Visual Studio project, however the referenced files had been moved and no longer existed at that location. Visual Studio had taken the DLLs from the GAC of the machine on which I had built the project. This machine had Tridion 2013 installed and so the custom resolver was compiled against 2013 DLLs without me even realising!

To fix it I simply updated the references to the correct location in SVN and all was good.

Tip
It’s a good idea to copy the suitable version of Tridion DLLs to a centralised folder to which you always make reference. Perhaps something like //dependencies/Tridion/2011/[DLLs go here]. This can be committed into your source control so all developers have them when needed. However, always check that Visual Studio has resolved the DLLs correctly in case of strange build version errors, especially for a project that hasn’t been touched for a while!

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>