Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable long file paths Visual Studio will respect?

I have multiple solutions that we changed to use deep folder structures / long file names. Some are failing to build due to long paths (exceeding 260 characters).

I have updated group policy / registry as indicated here and dozens of other places.

I can build using a command line dotnet build command, but building in Visual Studio (2022) fails, indicating it can't find a build-generated file. That error boils down to the path that the build would've written output / intermediate files to was too long so it didn't create the file later steps expect.

I know there are workarounds like redirecting working build folders, but am looking for how to allow Visual Studio to build as it does by default regardless of folder name length.

like image 694
John Spiegel Avatar asked Sep 14 '25 21:09

John Spiegel


1 Answers

I can build using a command line dotnet build command, but building in Visual Studio (2022) fails, indicating it can't find a build-generated file. That error boils down to the path that the build would've written output / intermediate files to was too long so it didn't create the file later steps expect.

I know there are workarounds like redirecting working build folders, but am looking for how to allow Visual Studio to build as it does by default regardless of folder name length.

The answer is NO.

You mentioned dotnet build is ok, that is because compiler issue fixed at 2019:

https://github.com/dotnet/roslyn/issues/32804

In that annonucement, you can see the official mentioned the feedback ticket about VS Tool:

https://developercommunity.visualstudio.com/t/allow-building-running-and-debugging-a-net-applica/351628

The devenv.exe.config doesn't opt into the long path support yet, so VS Tool doesn't support the feature.

So it is impossible currently to "allow Visual Studio to build as it does by default regardless of folder name length."

like image 164
Bowman Zhu Avatar answered Sep 16 '25 10:09

Bowman Zhu