Monday, January 4, 2016

Tridion Custom Tools Example Projects – Custom Resolver

I noticed many questions on Tridion SE, where new developers face issues with setting up projects for Tridion Custom Tools. So in this series of blog posts I am sharing some code examples and extensions for the same.

To start with, I am explaining to set up the Custom Resolver. I've set up a simple Example Code Project and could be found here , I've also shared the the Visual Studio Extension for it, if anyone wants to install a project template for custom resolver it could be found here.


Setting up the project:


1. Create a library project in Visual studio.

2. Add the following dlls as reference:

  • Tridion.Common
  • Tridion.ContentManager
  • Tridion.ContentManager.Common
  • Tridion.ContentManager.Publishing
3. Create a class say “MyCustomResolver” by extending from interface “IResolver”, which is found in “Tridion.ContentManager.Publishing.Resolving” namespace.

4. Implement the method public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, Tridion.Collections.ISet<ResolvedItem> resolvedItems)

5. Sign the Assembly with a Strong Name.

6. Build and add the assembly to GAC on CMS and Publisher Servers, In case you have a separate publisher server.


Installation Process (To be done on CMS and Publisher Boxes):


1. Copy the assembly “ExampleTridionCustomResolver.dll” in to the server.

2. Add the assembly to the GAC.

3. Open “Tridion.ContentManager.config” file from the path “%TridionInstall% \config”.

4. Locate xml element <add itemType="Tridion.ContentManager.ContentManagement.Component"> inside element <resolving> ---> <mappings>. Since we only want to override resolving behavior for components in this example.

5. Inside the child element <resolvers>, add element <add type=" ExampleTridionCustomResolver.MyCustomResolver" assembly=" ExampleTridionCustomResolver, Version=1.0.0.0, Culture=neutral, PublicKeyToken={PublicKeyToken}" /> as a LAST child.

6. Finally, save and close the Tridion.ContentManager.config file and from your list of Windows Services, restart all Windows services that start with Tridion Content Manager. Also restart IIS and the SDL Tridion Content Manager COM+ application. This applies your changes.

No comments:

Post a Comment