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

  • Anonymous
    May 25, 2010
    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?

  • Anonymous
    May 25, 2010
    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.

  • Anonymous
    May 26, 2010
    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!)

  • Anonymous
    December 20, 2010
    All Problems have ONE solution and that is: 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.

  • Anonymous
    December 29, 2010
    I had the similiar problem and finally I found solution: www.tooLongPath.com

  • Anonymous
    December 29, 2010
    I had the similiar problem and finally I found solution: <a href='www.tooLongPath.com'>www.tooLongPath.com</a>

  • Anonymous
    April 02, 2011
    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.

  • Anonymous
    November 30, 2011
    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.

  • Anonymous
    November 30, 2011
    The comment has been removed

  • Anonymous
    March 07, 2012
    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.
  • Anonymous
    September 17, 2012
    Long Path Tool helped me in this situation. http://PathTooDeep.com

  • Anonymous
    September 23, 2012
    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

  • Anonymous
    January 28, 2013
    its very good site for learn.if you want learn more then visit......... http://longpathtool.com/

  • Anonymous
    February 07, 2013
    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

  • Anonymous
    March 20, 2013
    Long path tool will help you to solve this issue.

  • Anonymous
    June 19, 2013
    Long path tool is the best solution for your problem. try it and solve your problem.

  • Anonymous
    August 19, 2013
    I just download and use "Long Path Tool" guarantees to fix your error fast and easy. Try it.

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

  • Anonymous
    July 14, 2014
    Hello, I suggest you to download new Long Path Tool software that simply allows you to work easily on Long Path files. Thank you.

  • Anonymous
    December 24, 2014
    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

  • Anonymous
    February 10, 2015
    Reduce IIS Virtual directory path length from ur Project properties

  • Anonymous
    February 11, 2015
    Long path tool is the best solution for your problem. try it and solve your problem

  • Anonymous
    July 04, 2015
    hello friends,use long path tool,its awesome

  • Anonymous
    July 15, 2015
    Hey, anyone used  “Long Path Tool” This tool is great Thanks

  • Anonymous
    September 12, 2015
    Try the Long Path Tool program this really helps

  • Anonymous
    September 29, 2015
    Try to use Long Path Tool program in this kind of problem. This is very helpful.

  • Anonymous
    October 24, 2015
    I would recommend in this case to try program Long Path Tool

  • Anonymous
    October 26, 2015
    I had the similar problem and finally I found solution form Long Path Tool. Its a wonderful Tool.

  • Anonymous
    November 07, 2015
    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.

  • Anonymous
    November 17, 2015
    Thanks alot...it resolved the error.