When running a Sitecore Azure deployment, ever see this error?
“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”
This is not an error specific to Sitecore.
In an attempt to better understand the Sitecore Azure API and find the files/paths preventing a successful deploy, I built the Sitecore Azure Build Verifier. This tool will execute a dry-run of a Sitecore Azure deploy, alerting you of files and folders which fail validation.
Follow the instructions within the project ReadMe to install.
Configuring a Build
What I found interesting about this problem was the fact that I had installed a test version of Sitecore 7.2 with Azure 7.2 (rev 140411) under the path C:\inetpub\wwwroot_sandbox\Azure72 – not an overly verbose instance name or root path location.
For those of you new to Azure in Sitecore, specifying the target location for builds is located within an Environment item, under the field Build Folder.
As you can see, the default is C:\inetpub\wwwroot_sandbox\Azure72\Data\AzurePackages. Sitecore Azure will, also by default, append additional folders to this path for each build instance executed from within the Azure module interface resulting in a build path such as:
Quickly looking at the path above, you’ll notice references to:
- Build instance
- Environment name
- Role instance and name
- DNS host name
Simply change the build folder to something with a shorter path. For example, set your path to C:\AzureBuild and you’re past this issue.
Verifying The Build
If you’re interested in which files/folders are preventing a successful deploy, install the Azure Build Verifier module. After installation, select an Azure Deployment item and right-click. Select the “Verify Deployment” option:
Upon making the selection, you’ll be presented with a dialog box displaying the list of files and paths which exceed the limits previously seen in the failed deployment:
If you’re interested in the implementation, check out the GitHub repo. Dig into the artifacts processor or the main verify class leveraging the Sitecore.Azure library to resolve its sources prior to processing.