Windows Azure - Resolving "The Path is too long after being fully qualified" Error Message

When you run a cloud service on the development fabric, the development fabric uses a temporary folder to store a number of files including local storage locations, cached binaries, configuration, diagnostics information and cached compiled web site content.

By default this location is: C:\Users\<username>\AppData\Local\dftmp

For the most part you won’t really care about this temporary folder, the Windows Azure Tools will periodically clean up the folder so it doesn’t get out of hand.

Note: To manually clean up the devfabric temporary folder, you can open an elevated Windows Azure SDK Command Prompt and run: “csrun /devfabric:shutdown” followed by “csrun /devfabric:clean”.  You really don’t need to do this but it can come in handy from time to time.

There are some cases where the length of the path can cause problems.

If the combination of your username, cloud service project name, role name and assembly name get so long that you run into assembly or file loading issues at runtime. This will give you the following error message when you hit F5:

“The path is too long after being fully qualified.  Make sure the full path is less than 260 characters and the directory name is less than 248 characters.”

For example, in my test, the path to one of the assemblies in my cloud service was:

C:\Users\jnak\AppData\Local\dftmp\s0\deployment(4)\res\deployment(4).CloudServiceabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr.WebRole1.0\AspNetTemp\aspNetTemp\root\aff90b31\aa373305\assembly\dl3\971d7b9b\0064bc6f_307dca01\Microsoft.WindowsAzure.Diagnostics.DLL

which exceeds the 260 character path limit.

If you aren’t married to your project and assembly names, you could name those differently so that they are shorter

The other workaround is to change the location of the development fabric temporary folder to be a shorter path.

You can do this by setting the _CSRUN_STATE_DIRECTORY to a shorter path, say “C:\A” for example.

image

Make sure that you close Visual Studio and shutdown the development fabric by using the “csrun /devfabric:shutdown” command I mentioned above or by clicking “exit” on the Windows Azure the tray icon.

After making this change, my sample above was able to run without problem.

Of course, this workaround really only buys you more characters and ultimately you may have to simply reduce your path lengths through renaming.