Setting up Custom Resolver in SDL Tridion

Maintaining large Business Data is always a big challenge. When you need to publish your component to your storage which internally is using more than 50 other different types of components (for example), then you must need a mechanism to control the resolving of these many items every time they are linked with some other component for some other page and gets published. It’s not wise, isn’t it? Exactly!

Now the one who loves spending more money 🙂 can have multiple publisher configured for a single CMS so that his resolving is fast enough hence the publishing and he gets back to the business.

But hey! did it save you from publishing the same component multiple times with other components as well.

Well that’s the whole point we are going to discuss here.

Custom Resolver, as the name suggests, provides you a mechanism to decide onto what and when do you want to resolve which item during your publish.

You can read more about this on SDL Live Docs. You can also google it out there. I like the post Chris Summers has written and the simple idea in a post Nuno Linhares has given few years back. There you will get the sample usecase and the codes as well.

Presuming, you are ready with your Custom Resolver dll, at the very fundamental level, Below are the steps you should follow while setting it up in Content Manager Server (CMS) or in Publisher Server:

Perquisites

Custom Resolver dll. (Ex: Company.Tridion.Relovers) 

Steps

1. Copy Company.Tridion.Relovers dll to any of the folder in Content Manager Server.

2. Register your dll to GAC. Steps below:

2a. Open Powershell as Administrator and run following command in sequence.

PS C:\Windows\system32> [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

GAC Version Location
--- ------- --------
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50...

PS C:\Windows\system32> $publish = New-Object System.EnterpriseServices.Internal.Publish
PS C:\Windows\system32> $publish.GacInstall("<YOUR_PATH>\Company.Tridion.Resolvers\Company.Tridion.Resolvers.dll")

2b. Check whether your dll is registered successfully using below command:

PS C:\Windows\system32> [reflection.assembly]::LoadWithPartialName("Company.Tridion.Resolvers")

GAC Version Location
--- ------- --------
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Company.Tridion.Resolvers\v4.0_1.0.0.1__ef647947efkdje...

2c. Make sure you take a note of your Version and Public Token  of your dll which is present as the folder name in the GAC where your dll is registered and also in the properties of your dll.

custom-resolver-1

According to above screenshot your:

  • version is 1.0.0.1 and
  • Public Token is e4s79jlre6546p0d

3. Locate the <CMS_CONFIG_PATH>\Tridion.ContentManager.config file and target the <resolver> section of that item you want to deal with, within your resolver. Like Page/Page Templates/Component etc. In our case I will only take Component as an example.

3a. Locate Tridion.ContentManager.CommunicationManagement.Component in <CMS_CONFIG_PATH>\Tridion.ContentManager.config file.

3b. Now replace/update the below:

<add itemType="Tridion.ContentManager.ContentManagement.Component">
 <resolvers>
    <add type="Tridion.ContentManager.Publishing.Resolving.ComponentResolver" assembly="Tridion.ContentManager.Publishing, Version=8.2.0.732, Culture=neutral, PublicKeyToken=360aac4d334trgb"/>
 </resolvers>
</add>

With your dll, Version and Public Token updated in it like below:

<add itemType="Tridion.ContentManager.ContentManagement.Component">
 <resolvers>
    <add type="Company.Tridion.Resolvers.ComponentResolver" assembly="Company.Tridion.Resolvers, Version=1.0.0.1, Culture=neutral, PublicKeyToken=<This is your dll's Public Token>"/>
 </resolvers>
</add>

4. Start the Tridion Services. (Tridion Host Service , Tridion Publisher Services and Reset IIS for safe side)

Note: If you want to Remove your registered dll from GAC, use below command:

$publish.GacRemove( "<YOUR_PATH>\Company.Tridion.Resolvers\Company.Tridion.Resolvers.dll")

Important:

If you have separate Publisher Server, Do not forget to install your Custom resolver there. its very important or else your Publisher will never know your custom resolver and it will not be triggered when the resolve event is triggered in CME GUI when clicking Show items to Publish in Publishing Window.

An advice from Nuno Linhares:

You should always deploy Event Systems everywhere they should be executed and resolving will be triggered by the UI if you click on “show items to publish” and by the Publisher when publishing. So you need it on CME and/or on Publisher.
As a guideline, I would recommend that all CM machines have the same events deployed, makes it easier to rebuild as well in case of Disaster Recovery.

That’s it. Enjoy exploring  🙂

If you still need help, Please post your question on Tridion Stack Exchange (Trex)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s