Problem Path length allowed for new project in VS2005

I am getting a very strange error in VS2005 Team Developer Edition. Here is
the scenario: I go into FILE/NEW/PROJECT/Visual C# Windows Console
Application. I get the New Project dialog box. I am looking to use the
following as the Location: "C:\Documents and Settings\XXXX
XXXXXXXXX.ZZZ-ZZZZZZZZZZZ\My Documents\Microsoft Press\Visual CSharp Step By
Step\Chapter 1" (I have replaced my name with X's and my machine name with
Z's in the example above.) I am naming the aplication: "WindowsApplication1"
or somthing that length.

It is clear that this is a long path but well under 260 characters - the
length that I understand is the max for my OS (Windows XP using an NTFS file
system).

When I do this I get an error as follows: "The length of the full path for
the solution, project or item you are creating exceeds the maximum path
length allowed by the system. You must reduce the length of the name or
location".

I  calculated the string in question and it was 141 characters.
Interestingly enough, if I truncated one character, it was accepted. But I
have seen other incidents where the length was allowed to be greater.

Does anyone know why this is happening and/or whether it can be fixed


Answer this question

Problem Path length allowed for new project in VS2005

  • persoontje

    I'm having same problem, any new light on this:

    I'm trying to create new project like this:

    Name: TIE.HSD.Primary.Medicaid.XEngine.GUITester

    Location: C:\Tie30\HSD\Primary\Medicaid\TIE.HSD.Primary.Medicaid.WS

    If I shorten "GUITester" to "Test" it works.


  • Ruud van der Werf

    You are correct that the OS limit is 260 characters (MAX_PATH). However, the computation is:

       Path length + 1 (separator) +
       Solution name length + 1 (separator) +
       Project name length + 1 (separator) +
       Project name length +
       80 (Reserved space)

    The project name length is added twice: Once for the folder name and once for the file that holds your project itself (.vbproj, .csproj etc.). The 80 additional reserved characters are for the files that you place in the project. Most new project templates create several sub-folders for intermediate files that help with like intellisense and debugging. While we may not use the full 80 characters, it is a sensible limit.

    In your example, the computation is:
       122 + 1 +
       19 + 1 +
       19 + 1 +
       19 +
       80
       = 262

    I hope that explains the error message you're seeing.



  • phikappa

    This is absolutely ridiculous. I am able to put a VS 2003 project in the exact location that VS 2005 won't let me. I'm am so tired of MS ignroing their own best practices.
  • Mubashar

    I appreciate the quick reply. The knowledge I gained from it + a tip at http://support.microsoft.com/ kbid=310147 on how to change the "My Documents" folder default location will help me avoid this problem in the future.

    BTW, I almost spent one of my incident supports on this as it was really bugging me. I doubt whether I would have gotten a quicker and/or more complete answer to my question.

  • Ruud Borst

    I'm a bit confused by the last response.

    I thought MAX_PATH was only a limitation of apps using the ASCI CreateFile api and that the unicode api allowed pathnames up to 32,000 unicode characters long.


  • kefka95

    Amen!

    2003 could do it, and now 2005 cannot We have to change our established naming pattern to accomodate this max length.

    This seems like it should be fixed with a patch / service pack.


  • Sukesh Nambiar

    This issue is annoying and I worked around it by doing the following:

    1. Create a dummy name for the project that will meet the length requirements.

    2. In VS2005 after the project is created/loaded, change the project name to the long name VS2005 wouldn't accept.

    3. Save All.

    4. Close solution.

    5. Change the project folder name in Windows Explorer to the long name.

    6. Modify the VS2005 solution file in Notepad and change the referenced project folder to use the long name.

    You can also create the project at C:\Temp, copy the project folder to where you really want it to live, and then File->Add->Existing Project... just fine and it doesn't require any modification of files or folder names. The same holds true for creating solutions.


  • Problem Path length allowed for new project in VS2005