CSProj - NET5: Unable to create project with path length > 259 characters

Paul Quinn 1 Reputation point
2021-01-26T16:39:22.29+00:00

With a project where the path to the csproj is (including the csproj filename) is greater than 259 char, in VS, if I:

  • Create a new project (any, inc class lib) from a template I get:
    "Consider reducing the length of the name or location for this solution or project. The system will fail to create nested files that exceed the maximum allowed path length."
  • Create the project elsewhere higher up the filesystem, then move, and try to add the project to an existing solution, VS crashes
  • Create the project elsewhere higher up the filesystem, then move, and try to open the project, VS doesn't open (fails silently?)
  • Create using dotnet new writes the files to the filesystem, but then the projects won't load (see above)

I've tried with both VS (Community) 16.9.0p3 and 16.8.4.
I've tried the long path support reg keys/group policy switches (with reboot), am running W10Pro 20H2 (19042.782)

I thought long paths were supported in NET5/VS/Windows now? This shouldn't be happening should it....?

Developer technologies Visual Studio Other
Community Center Not monitored
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2021-01-27T06:07:44.703+00:00

    Hi paulquinn,

    Please refer to this document: Maximum Path Length Limitation

    • Add "\?\" before your long path
    • Enable long path in system registry

    Best Regards,
    Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our **documentation to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.