Description
As seen in Fix 260 character file name length limitation, there's quite a bit of support for better longer-than-MAX_PATH
-filename handling.
Will Buik's response w/regard to fixing it was:
We understand that this can be a frustrating issue, however, fixing it requires a large and complicated architectural change across different products and features including Visual Studio, TFS, MSBuild and the .NET Framework. Dedicating resources to this work item would come at the expense of many other features and innovation.
I wondered, how big can those architectural changes be (for MSBuild)?
According to Naming Files, Paths, and Namespaces: Maximum Path Length Limitation, (which I have mirrored here ):
The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the
lpMaximumComponentLength
parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the"\\?\"
prefix. For example,"\\?\D:\very long path"
.
[other stuff]Because you cannot use the
"\\?\"
prefix with a relative path, relative paths are always limited to a total of MAX_PATH characters.
(emphasis mine)
...Which means that wherever MSBuild uses full paths, we can should be able to just prepend "\\?\"
to ask for a long path.
Of course, we'd need to rework the existing path-length-workaround hack.
This won't fix the whole ecosystem, but it'll get us just one step closer.
I'd like to fix this myself (it seems simple enough), so in accordance with:
- Contributions must be discussed with the team first, or they will likely be declined. As our process matures and our experience grows, the team expects to take larger contributions.
- Only contributions referencing an approved Issue will be accepted.
...this is the suggested issue.
I'm a native developer at heart, not an experienced C# developer, but this shouldn't require anything crazy.
Direct references to MAX_PATH: