C# FileVersionInfo.GetVersionInfo()异常,路径很长

C# FileVersionInfo.GetVersionInfo()异常,路径很长,c#,.net,C#,.net,FileVersionInfo.GetVersionInfo()在与非常长的路径一起使用时引发异常,因为它调用Path.GetFullPath()。如何解决这个问题 例如: FileVersionInfo.GetVersionInfo(veryLongPath) 堆栈跟踪: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file n

FileVersionInfo.GetVersionInfo()
在与非常长的路径一起使用时引发异常,因为它调用
Path.GetFullPath()
。如何解决这个问题

例如:

FileVersionInfo.GetVersionInfo(veryLongPath)
堆栈跟踪:

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.SafeSetStackPointerValue(Char* buffer, Int32 index, Char value)
   at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String fileName)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)

你能展示一下这个异常的例子和堆栈跟踪获得的细节吗?@Amy我正在使用.NET framework 3.5