gpt4 book ai didi

c# - 在 asp.net web 应用程序中连接到 SVN

转载 作者:太空狗 更新时间:2023-10-30 00:36:29 25 4
gpt4 key购买 nike

通过 C# 创建存储库有多难?在 Web 应用程序中查看源代码文件或差异怎么样?

是否有我需要 Hook 的 API,还是我必须编写所有自定义代码?

最佳答案

SharpSVN为您提供完整的 API。它不是那么容易使用,并且通常很慢,除非您缓存您取回的项目。

SharpSvn is a binding of the Subversion Client API for .Net 2.0 applications contained within a set of xcopy-deployable dll's. Notable users of this api are (at this time):

  • AnkhSVN 2.X - Subversion Support for Visual Studio 2005 and 2008
  • CollabNet Desktop for Visual Studio
  • SharpDevelop (#develop)
  • MonoDevelop
  • SVN-Monitor
  • And many, many other projects..

这是一个我完成了大约 50% 的 ASP.NET 项目的示例,它显示了存储库中的所有项目:

using (SvnClient client = new SvnClient())
{
client.LoadConfiguration(Server.MapPath("/"));
SvnUriTarget target = new SvnUriTarget("http://wush.net/svn/yourusername/", SvnRevision.Head);
SvnListArgs args = new SvnListArgs();

Collection<SvnListEventArgs> svnList = new Collection<SvnListEventArgs>();
client.Authentication.DefaultCredentials = new NetworkCredential("username", "password);
args.Depth = SvnDepth.Children;
client.GetList(target, args, out svnList);

foreach (var item in svnList)
{
// display the list
}

}

关于c# - 在 asp.net web 应用程序中连接到 SVN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1750430/

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