Visual Studio 2008 引用过长?

3

我最近重新组织了我们的源代码控制,并发现我们的一个解决方案无法构建。唯一的错误是:

错误 65 未知构建错误,“指定的路径、文件名或两者都太长。完全限定的文件名必须少于260个字符,目录名必须少于248个字符。”

我在Visual Studio中检查了每个引用,每个引用的最长完整路径(路径和文件名)为161个字符。

我的解决方案文件夹结构如下:

C:\projects_svn\ABC\branches\01.02.03\ABC\ABC SUITE\ABC.DEF.GHIJKLM.NOP\

任何帮助都将不胜感激,考虑到项目规模,我认为这个文件夹结构并不算太长,并且可以更好地组织事物。

以下是一些技术细节,可能有所帮助(如果需要更多,请告诉我):Visual Studio 2008 SP 2 运行在 Windows XP 或 Windows 7 上。使用 Subversion 作为 SCM。使用 C#/WPF 进行编码。

谢谢


那个文件夹里有什么?我没有看到任何.cpp文件。 - GManNickG
在那个文件夹里有一个 .sln 文件和我的项目文件 (.cs, .wpf 等)。 - Russell
2个回答

5
我认为这里可能发生的情况是,你的一个项目使用了相对提示路径,它在树形结构中向上走得很远,然后再返回目录结构。例如:

c:\foo\bar\baz\..\..\..\some\other\dir\foo.dll

即使实际文件的路径小于256个字符,但相对路径会使其变得更长。
查找这些路径的最佳方法是搜索所有的.csproj / .vbproj文件中的字符串“..\..\"。看看是否有任何结果。

谢谢Jared,那很可能是原因。不幸的是,我看不出是什么导致了这个问题。 - Russell
太棒了,感谢您的帮助。您的建议让我缩小了范围,我找到了引起问题的参考资料。 - Russell

0

你还需要考虑 SVN 的“背景”文件。

虽然我可能有一个像这样的短文件名: c:\myfolder1\myfolder2\MyFile.txt

但很可能潜伏着一个更长的文件名版本,如下所示: c:\myfolder1\myfolder2.svn\text-base\MyFile.txt.svn-base

而那个背景文件就是会出现“太长”的错误。

以下是我通过使用 SVN 源代码控制调用 MSBUILD 文件时通过 CCNET 得到的结果。 为了保护无辜者(和我的工作!),特定名称已被删除。

请注意,这种“名称处理”会导致较短的路径,可能不会生成错误。也就是说,不要计算我处理后示例中的字符数。 但错误消息就是我得到的。

    Removing directory "C:\CCNETEnvironment\MyFolder2\MyProject\working\checkout".
    C:\src\MyFolder1\MyProject\My_MSBuild.xml(173,5): error MSB3231: Unable to remove directory "prop-base". 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.
    C:\src\MyFolder1\MyProject\My_MSBuild.xml(173,5): error MSB3231: Unable to remove directory "text-base". 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.
    C:\src\MyFolder1\MyProject\My_MSBuild.xml(173,5): error MSB3231: Unable to remove directory "prop-base". 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.
    C:\src\MyFolder1\MyProject\My_MSBuild.xml(173,5): error MSB3231: Unable to remove directory "text-base". 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.
    C:\src\MyFolder1\MyProject\My_MSBuild.xml(173,5): error MSB3231: Unable to remove directory "C:\CCNETEnvironment\MyFolder2\MyProject\working\checkout". Could not find a part of the path 'MyFile.txt.svn-base'.
Done building target "Clean" in project "My_MSBuild.xml" -- FAILED.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接