Blog

File Name Length Error in TDS

May 05, 2015 | Angel Uzunov

By default Microsoft has a character limitation for file paths. The folder and file name must remain under 260 characters. If you’re familiar with Twitter, 260 characters seems like a breeze. However, most projects easily hit that limit. For this we created a work around in TDS.

The File Alias function in TDS allows you to shorten the file path to fit in the requirements that Microsoft set. You’ll probably see the following error if trying to sync items into a TDS project tree that already exceeds the path length:

“The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters”

Imagine you have the following tree existing in your Sitecore instance and TDS:

 

If you browse the tree inside Windows Explorer, you’ll see the same folder structure, replicated on the file system – this is how items are serialized:

Now let’s look at the file system alias – going back into the TDS project and viewing the properties of an item or folder in the tree, you’ll see a File system Alias section there:

Simply inserting a name of your choosing there will result in the item being renamed on the file system. In this case, we renamed the Sitecore folder named “FolderOne” to just “1”:

If we now go and check back on the file system, we’ll see that the path to our template has changed, and has effectively become shorter by 7 characters.

We can always give alias to more items in the tree, in order to achieve shorter paths:

Sometimes people get worried that the alias of items in their TDS project will screw with the item names in Sitecore. As you’ve seen above, an item consists of 2 parts – the item inside the TDS project and then the serialized .item file itself. After undergoing the alias process, the item keeps the original name and path; what changes is the path/name on the file system itself. This will not affect the name in Sitecore.