Windows 10路径限制错误

分享于 

2分钟阅读

互联网

  繁體

问题:

我已经在本地组策略中将LongPathsEnabled设置为 1

然后重新启动 Windows 机器。但仍有以下错误


Unable to create output Directory C:Usersxxxxxxx. Failure Reason 


System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.


at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)


at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)


at System.IO.Directory.CreateDirectory(String path)


at Atmel.VsIde.AvrStudio.MakeBuilderService.MakeFileWriter.CreateOutputFolders(IEnumerable`1 subDirectories)



我缺少了什么?

Windows 10 Pro,版本1803,OS Build 17134.590


回答 1:

你必须在应用程序的清单中使用特定的指令。


<application xmlns="urn:schemas-microsoft-com:asm.v3">


 <windowsSettings>


 <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>


 </windowsSettings>


</application>



你可以在这里找到更多详细信息: https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/


回答 2:

你是如何尝试创建目录的?

我建议你启用 GPO,同时添加注册表值"longpathsenabled",并阅读下面的文章是否不支持长路径名。

https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation