Sitecore Quicktip: New Steps to Create a Publishing Target in Sitecore 10.1
For those creating additional publishing targets (ex. web_preview) in 10.0 or sooner, you are familiar with the common steps of configuration files and creating a target in the CMS… but starting with 10.1 there are additional steps required related to the creation of a .dat file.
Comparing Sitecore 10.0 and 10.1, you will see that most of the steps are the same (always review the config files for any changes). Here is the 10.0 documentation: Create a publishing target (sitecore.com)
However, in 10.1+ there are two new steps to consider as follows:
In the App_Data\items\ folder, make a copy of the Web folder.Create a publishing target (sitecore.com)
Rename the copy of the folder and the .dat file inside it. Use the database name (for example, web_preview) instead of web for the folder name and the file name (so the filename is similar to items.web_preview.dat).Create a publishing target (sitecore.com)
Full details on the 10.1 steps are as follows: Create a publishing target (sitecore.com)
The steps in the 10.1 guide above are critical because if you miss this, and still do all the normally expected steps, it’s likely you will get a null value reference if you switch to your preview database in Sitecore Desktop and a missing item value if you try to open the site in a browser. This is because even though you can publish some items to the target, it is missing the primary .dat reference required to allow a full publish (including the root) to the new publishing target.
Of note, beyond these steps, don’t forget to create the actual publishing target within the CMS Content Tree, as that is not explicitly listed as a step in the documented instructions.
Important: Once you create the .dat file you will need to manually trigger an Application Pool recycle (or stop/start the CMS Azure App Service) as .dat files don’t trigger an Application Pool recycle like a .config does.
Great topic, thank you! I faced it when migrated from 9.3 to 10.2 and it fixed my issue.
If I can include anything, I’d say that if you’re patching this extra publishing target, pay attention when trying to reuse the config file from an old version. The 10.2 changed some lines when adding extra publishing target.