gpt4 book ai didi

c# - 发布 MVC 4 应用程序时出现 PathTooLongException。指定的路径、文件名或两者都太长

转载 作者:行者123 更新时间:2023-11-30 16:53:51 25 4
gpt4 key购买 nike

尝试使用 VS2012 发布我的 MVC 4 项目时出现以下错误:

Error 8 The "CollectFilesinFolder" task failed unexpectedly. 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.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.IO.FileSystemInfo.get_FullName()

错误不会在构建解决方案(调试或发布)时发生,它只会在发布(文件系统)时发生。

我无法确定是哪个文件、目录或路径导致了问题。

如何或在哪里可以看到导致问题的原因?

这是我的输出窗口的输出。对于解决此问题的任何帮助,我将不胜感激。谢谢!

Error 8 The "CollectFilesinFolder" task failed unexpectedly. 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.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.IO.FileSystemInfo.get_FullName()
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Regex[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)
at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() 0 0 Nop.Web

最佳答案

当您的解决方案包含名称很长的项目和/或具有大量嵌套命名空间和/或位于较深的子文件夹中时,就会发生这种情况。

尝试将它移到更靠近根文件夹的位置,例如 X:\Projects\甚至 X:。如果这还不够,您将被迫重命名您的命名空间

关于c# - 发布 MVC 4 应用程序时出现 PathTooLongException。指定的路径、文件名或两者都太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30986299/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com