Child Publications Only Resolver

A year ago I commented on an article written by Alvin Reyes which described a neat trick on how to make your life easier with BluePrinting. The article explains how you publish all your BluePrint children simply by adding a Publication Target to your structure parent. The downside of this is that you are also Publishing all the items from your struture parent, while these might not need to be Published at all. My comment was a small improvement to this done via a Custom Resolver, which removes all the unwanted items. I added some sample code for that custom resolver to my comment, but it being a comment, that is rather unreadable. So here is the complete Custom Resolver code with a clear installation instruction.

The Resolver DLL is compiled against 2013 SP1, but it comes with full source, so you can also compile it yourself against 2011 or even 2009 (when the resolver process was introduced) to use on your own (older) systems.

Configuration is done by means of a .Net ExeConfigurationFileMap (ChildPublicationsOnlyResolver.config), since the Resolver DLL is loaded into the GAC, we place the configuration file in the ..\Tridion\config directory, for easy retrieval. The configuration only contains one setting:

  1. WebsiteStructurePublication - the TCMURI of your structure parent Publication

Installation

This eXtension comes with full source as a Microsoft Visual Studio solution which you can directly compile and deploy (you can use the free Microsoft Visual Studio Express edition). To install the event handler you need to place the assembly on the SDL Tridion Content Manager server and register it as described in the following steps.

  1. Start with shutting down the following services on your Content Manager server:
    1. IIS ChildPublicationsOnlyResolver.config
    2. The SDL Tridion COM+ application
    3. The Tridion Content Manager Service Host service
    4. The Tridion Content Manager Publisher service 
  2. Compile the solution to a .NET assembly and store in the Global Assembly Cache, you can do this by uncommenting the commands in the Pre and Post build steps of the project (or you can use the already compiled assembly on a 2013 SP1 system and upload it via the gacutil.exe).
  3. Copy the file ChildPublicationsOnlyResolver.config to the ..\Tridion\config directory.
  4. Open the configuration file called Tridion.ContentManager.config, located in the config subfolder of the Content Manager root location (typically C:\Program Files\Tridion\), in a plain-text or XML editor. Find the <resolving> element in this file. In there you will want to add the following line to each of the item types (except Tridion.ContentManager.AudienceManagement.TargetGroup and Tridion.ContentManager.ContentManagement.Folder):

    <add type="Example.ChildPublicationsOnlyResolver" assembly="ChildPublicationsOnlyResolver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=26c2d68fe54df544, processorArchitecture=MSIL" />

    The PublicKeyToken is what you will need to get from the GAC
  5. Save and close Tridion.ContentManager.config
  6. Configure ..\Tridion\config\ChildPublicationsOnlyResolver.config to your liking (by setting the correct Publication TCM URI in there)
  7. Restart the services you stopped

You can now use your Content Manager as you normally do. When you want to Publish all children in your BluePrint, select the advanced publishing option to also publish in child publications. Selecting "Show Items to Publish" will show what�s queued for corresponding child publications, and the items from your configured structure Publication will automatically be removed.

If you combine this Resolver with my Empty Publish Transactions Event Handler you might want to make a small adjustment to its code, so that it doesn't set the Warning state on the Publish Transaction(s) from the structure Publication. I've adapted the code for this on Google code, the Event handler reuses the ChildPublicationsOnlyResolver.config to ignore the items from the structure Publication (showing a true integration between the Resolver and the Event Handler).


Developer
:    Bart Koopman
Company
License agreement
Tags
:    Custom,  Resolver,  2013,  2011,  Publish ,  BluePrint
Version
:   1.0
Source
:   Yes

About the Author
Bart Koopman
Community Development Consultant

As a Community Development Consultant, Bart is the evangelist of all SDL Tridion products. Bart used to be a consultant and trainer at SDL Tridion, supporting both partners and customers with their implementations.

SDL CMT division