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.

Comments (30)

  1. George Pollard says:

    I've just run into this and changing the output folder to (e.g.) <code>C:A</code> hasn't worked.

    Is there a way to get the exact path which is causing problems to be printed?

  2. jnak says:

    Hey George, we don't have a way to show the path today, I've filed a bug to get that added as a diagnostic.  You should see an s0 folder if the change worked.  You can look in the appdata dftmp folder to see if it is still using the old path.  Just clean up that folder and see if new stuff gets added to it (again that s0 folder).

    Also make sure that all of the VS and devfabric process are stopped and then started after you add the environment variable.

  3. porges says:

    Figured this out; it was actually the folder depth for the Azure solution that was causing the error.

    Hopefully the added diagnostic will help with figuring this out in the future 🙂 (Of course, fixing the limit would be better!)

  4. alan.larky says:

    All Problems have ONE solution and that is:

    http://www.longPathTool.com

    Path too long.

    Error cannot delete file: cannot read from source file or disk

    Cannot delete file: Access is denied

    There has been a sharing violation.

    Cannot delete file or folder The file name you specified

    is not valid or too long. Specify a different file name.

    The source or destination file may be in use.

    The file is in use by another program or user.

    Error Deleting File or Folder

    Make sure the disk is not full or write-protected and that the file is not currently in use.

    Path too deep.

  5. bob.marty says:

    I had the similiar problem and finally I found solution:

    http://www.tooLongPath.com

  6. bob.marty says:

    I had the similiar problem and finally I found solution:

    <a href='www.tooLongPath.com'>www.tooLongPath.com</a>

  7. Sean says:

    Unbelievable. It's bad enough that there is an arbitrary 260-character path limit. It's worse that the very company who put that limit in place releases a tool that is all but guaranteed to violate said limit.

    Thanks for the tips, Max. This should work for me.

  8. Venu says:

    It seems above method couldn't fix the issue. I did following one to fix the issue.

    Open Cloud***.ccproj.user file notepad

    Add <ServiceOutputDirectory>C:azuretmp</ServiceOutputDirectory>

    Build your project, it should build new package.

  9. Aniket says:

    Changing the Variable name didn't work for me. But Following setting helped me and I am able to build a package of my project.

    Open User's Azure Project file (e.g.: “XXXXX.ccproj.user” file ) in notepad add the following entry to <PropertyGroup> node.

    <ServiceOutputDirectory>C:azuretmp</ServiceOutputDirectory>.

    Then Build the Azure package.

    Hope it will work for you.

    Thank You.

  10. JoshuaReen says:

    I have also faced this type of error problems and I have used “Long Path Tool” in this situation and it helped me easily and quickly. This tool can fix all the error messages like:

    1. Path too long

    2. Cannot delete file: cannot read from source file or disk

    3. Cannot delete file: Access is denied

    4. There has been a sharing violation.

    5. The source or destination file may be in use.

    6. The file is in use by another program or user.

    7. The file name you specified is not valid or too long. Specify a different file name.

    and all other related error messages.

    I hope you will find this solution helpful and don’t forget to leave your comments.

  11. GabrielNar says:

    Long Path Tool helped me in this situation. http://PathTooDeep.com

  12. AttilaNab says:

    Hello. i was also having the same issue but Long Path Tool helped me in this situation. You can see here http://PathTooDeep.com. It might help you as well.

    Thanks and Regards,

    Attila

  13. juthi543 says:

    its very good site for learn.if you want learn more then visit………

    http://longpathtool.com/

  14. novelltes karrychay says:

    All Problems have ONE solution and that is:

    LONG PATH TOOL

    Path too long.

    Error cannot delete file: cannot read from source file or disk

    Cannot delete file: Access is denied

    There has been a sharing violation.

    Cannot delete file or folder The file name you specified

    is not valid or too long. Specify a different file name.

    The source or destination file may be in use.

    The file is in use by another program or user.

    Error Deleting File or Folder

  15. stevenManilov says:

    Long path tool will help you to solve this issue.

  16. franklo says:

    Long path tool is the best solution for your problem. try it and solve your problem.

  17. adamdee says:

    I just download and use "Long Path Tool" guarantees to fix your error fast and easy. Try it.

  18. Sam says:

    Thanks, this saved me a lot of pain. I only saw this issue after deleting my temporary ASP net files folder

  19. anthonyk says:

    Hello,

    I suggest you to download new Long Path Tool software that simply allows you to work easily on Long Path files.

    Thank you.

  20. Patrick8 says:

    I suggest to try "Long Path Tool" program .

    before I have problem cannot copy file because file name too long on Windows OS. and after I found long path tool and now my problem solved

    Thanks

    Patrick

  21. Kishore says:

    Reduce IIS Virtual directory path length from ur Project properties

  22. keywin says:

    Long path tool is the best solution for your problem. try it and solve your problem

  23. parick says:

    hello friends,use long path tool,its awesome

  24. Trickhere says:

    Hey,

    anyone used  “Long Path Tool”

    This tool is great

    Thanks

  25. Kevin15 says:

    Try the Long Path Tool program this really helps

  26. kevin15 says:

    Try to use Long Path Tool program in this kind of problem. This is very helpful.

  27. joshua42 says:

    I would recommend in this case to try program Long Path Tool

  28. davehu says:

    I had the similar problem and finally I found solution form Long Path Tool. Its a wonderful Tool.

  29. Karin9 says:

    when you copy or move a file and face problem such that file is too deep or long, in this situation i get many suggestions from  many sites to check Long Path Tool, i hope you will get some solution.

  30. Praveen says:

    Thanks alot…it resolved the error.