visual-studio - VisualStudio PathTooLongException
问题描述
我遇到了 VisualStudio 的问题 - 2017 Pro 和 2019 Pro。如果我尝试打开我的解决方案,我会收到以下错误:
VS2019 中的报错信息有点不同,但含义相同。当我调查 ActivityLog 文件时,只有这个节点对此问题感兴趣:
<entry>
<record>698</record>
<time>2019/07/03 08:14:00.064</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>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.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)

at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)

at System.IO.Path.InternalGetDirectoryName(String path)

at Microsoft.VisualStudio.ErrorListPkg.PathColumnDefinition.GetCachedDirectoryName(ITableEntryHandle entry)

at Microsoft.VisualStudio.ErrorListPkg.PathColumnDefinition.TryCreateStringContent(ITableEntryHandle entry, Boolean truncatedText, Boolean singleColumnView, String& content)

at Microsoft.VisualStudio.Shell.TableControl.TableEntryHandleExtensions.TryCreateStringContent(ITableEntryHandle entry, ITableColumnDefinition column, Boolean truncatedText, Boolean singleColumnView, String& content)

at Microsoft.VisualStudio.Shell.TableControl.Implementation.TableControl.GenerateFiltersForColumn(UpdateResults results, ITableColumnDefinition columnDefinition)

at Microsoft.VisualStudio.Shell.TableControl.Implementation.TableControl.UpdateEntryFilters(UpdateResults results, HashSet`1 variableColumns)

at Microsoft.VisualStudio.Shell.TableControl.Implementation.TableControl.UpdateEntries(HashSet`1 variableColumns, Boolean anyColumnChanges, List`1& frozenSinksAwaitingDisposal)

at Microsoft.VisualStudio.Shell.TableControl.Implementation.TableControl.<UpdateEntriesAsync>d__182.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
</entry>
有什么方法可以准确地找出错误的路径吗?我怀疑 SpecFlow addid 引起了这个问题。但是如果我禁用这个插件,什么都不会改变。
另一个队友使用相同的解决方案没有这个问题。
解决方案
我以某种方式摆脱了这个错误信息。我不明白如何,但让我分享我所做的步骤。
- 我开始一一从解决方案中删除项目,以找出导致问题的项目。
一旦找到坏的,我就恢复了 GIT 上的所有更改。
我对这个项目中的文件和文件夹重复了这种方法。当我删除一些文件并重新启动VS时,问题就消失了。
再次恢复 GIT 上的所有更改。
瞧,这个错误在 2017 年和 2019 年都是历史。SLN 或 CSPROJ 文件中没有任何变化。
推荐阅读
- python - 熊猫:同一天和同一月的年份 pct_change
- c# - 在 MVC C# 中将对象传递给 ActionFilter 构造函数
- python - 根据列值删除行中的重复项
- woocommerce - 使用 woocommerce 进行 Paypal 和数字下载:PDT 还是 IPN?或者是否有关于如何实现两者的教程?
- spotfire - 在 spotfire 的文本区域中显示的信息链接参数
- python - 如何让 Atom 看到正确的 Python 版本的虚拟环境?
- r - 是否可以将 SQL 代码转换为 R 代码?
- java - 模拟在java中被多次调用的方法
- c++ - 如何工作 std::condition_variable::wait_until
- performance - 装配 strlen AVX512BW 优化和加速