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:
Custom Resolver dll. (Ex: Company.Tridion.Relovers)
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=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") GAC Version Location --- ------- -------- True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_126.96.36.199__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_188.8.131.52__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.
According to above screenshot your:
- version is 184.108.40.206 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=220.127.116.112, 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=18.104.22.168, 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:
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)