0 Comments

Syncing Sitecore items into TDS is pretty straightforward, except when it starts throwing exceptions about file paths being too long for Windows. The usual fix is moving your TDS project/s up a few directories, or use TDS’ “File System Aliasing” on particularly long part/s of the content tree.

With a few tweaks I had this in place but nonetheless I still kept seeing exceptions about file path lengths, even though I knew all my *.item files that TDS should be generating would be well under the ~250 char limit imposed by Windows.

After pulling my hair out for ages I finally found the root cause. Even though I’d been limiting the file paths of the TDS output TDS relies on Sitecore’s built-in serialization output which it then copies over for itself. Sitecore’s serialization outputs into a folder governed by the Serialization Folder Sitecore setting, by default “$(dataFolder)/serialization”.The file path limit I was hitting was in here.

Luckily there’s a Sitecore setting to solve the problem. It’s full description (albeit confusing) in the web.config is:

<!-- SERIALIZATION - SERIALIZATION FOLDER PATH MAX LENGTH
In Windows, there is 248 characters limit on the length of file system paths. To avoid exceeding the maximum path length, the serialization API will shorten long path names. This setting specifies the maximum length of the path to the data/serialization folder, which determines how long item paths can be before they are shortened.
Important: The value of this setting must be the same on all Sitecore instances accessing the serialized data.
Important: When changing this value, it's recommended to remove the contents of the serialization folder and serialize all items again. Otherwise duplicates of serialized items may appear in the serialization folder.
Example: A value of "90" for this setting will mean that item paths longer than 150 characters will be shortened, since Sitecore reserves 8 characters (and 248 - 8 - 90 = 150).
Default value: 90
-->
<setting name="Serialization.SerializationFolderPathMaxLength"value="90" />

Long story short, the solution is as follows:

  1. Navigate to your serialization folder.
  2. Backup any serialized data you have in it to somewhere else.
  3. Determine your serialization folder’s path length.
  4. Increase the value of the “Serialization.SerializationFolderPathMaxLength” setting to be higher than yours. I’d recommend a patch file for abstraction from the web.config.
  5. Regenerate you serialized data.
  6. Ensure all Sitecore instances/environments get this setting update by adding the patch file to them.

Happy days :)

Post comment