C# LibGit2Sharp.NameConflictException“;文件名或扩展名太长。”;
我正在尝试使用repository.clone克隆git存储库 下面是一段用于clone命令的示例代码C# LibGit2Sharp.NameConflictException“;文件名或扩展名太长。”;,c#,git,max-path,C#,Git,Max Path,我正在尝试使用repository.clone克隆git存储库 下面是一段用于clone命令的示例代码 public string Clone(string remoteRepository, string path, string username, string password) { string myPassword; CloneOptions options = new CloneOptions(); options.CredentialsProvider =
public string Clone(string remoteRepository, string path, string username, string password)
{
string myPassword;
CloneOptions options = new CloneOptions();
options.CredentialsProvider = (url, user, cred) =>
{
return new UsernamePasswordCredentials {Username = username, Password = password};
};
return Repository.Clone(remoteRepository, path, options);
}
代码在某些存储库上运行良好,但对于其他存储库,我得到了例外
这是我得到的一个例外
{“无法统计文件“被剪断”:文件名或扩展名太长。\r\n”}
“剪断”路径的整体长度为270个字符。所以我知道这违反了极为古老的MAX_路径规则
根据一些windows文档,您可以通过在路径的开头添加\?\来使用unicode路径,这将允许在windows API调用中使用长路径。但是,这对LibGit2Sharp不起作用
有没有一种方法可以为LibGit2Sharp提供一个设置,使其能够处理长路径?或者如果失败,是否有其他nuget软件包允许这种行为?将其添加到允许长路径的App.manifest。我尝试使用
/?//
和unc
这两种方法都没有多大帮助。但这起作用了
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
真的
这是一个单独的DLL吗?然后需要修改DLL。