一个用C#从svn检出源代码的程序 [英] A program to check out source code from svn by C#

查看:356
本文介绍了一个用C#从svn检出源代码的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想编写一个程序,用C#查看svn的源代码。



你能帮助我吗?

解决方案

Google是你的朋友..这是以下搜索的第一个链接:



搜索条件:

c#程序从SVN退房



First Link:

svn-check-out-using-c-sharp -program [ ^ ]



在发布懒惰问题之前尝试自己的东西并不难。至少那时你会得到一些你可以发帖说不工作的示例代码等。


在项目中添加以下dll引用DotSvn.Client And DotSvn.Common。而不是使用以下C#代码。 





 使用 var  client =  new  SvnClient())
{
var repository1 = new Uri(txtURL.Text);
使用 var client1 = new SvnClient())
{
client1.Authentication.Clear();
client1.Authentication.DefaultCredentials = new System.Net.NetworkCredential( username password);
client1.Authentication.SslServerTrustHandlers + = 委托对象发​​件人,SvnSslServerTrustEventArgs e)
{
e.AcceptedFailures = e.Failures;
e.Save = true ;
};
System.Collections.ObjectModel.Collection< svnlogeventargs> logEntries;
var logArgs = new SvnLogArgs {Limit = 1 };
client1.GetLog(repository1,logArgs, out logEntries);
}

var arg = new SvnCopyArgs {LogMessage = < span class =code-string>
error};
var target = new SvnUriTarget( new Uri(txtURL.Text));

client.CheckOut(target,repositoryPath);

}
< / svnlogeventargs >


Hi everybody,

I want to write a program to check out source code from svn by C#.

Can you help me,please?

解决方案

Google is your friend.. this is the first link for the following search:

Search Criteria:
"c# program to check out from SVN"

First Link:
svn-check-out-using-c-sharp-program[^]

It is really not that hard to try stuff yourself before posting lazy questions. At least then you would have some sample code you could post saying isn't working etc.


Add the following dll references in your project DotSvn.Client And DotSvn.Common. and than use following C# code. 



 using (var client = new SvnClient())
                {
                    var repository1 = new Uri(txtURL.Text);
                    using (var client1 = new SvnClient())
                    {
                        client1.Authentication.Clear();
                        client1.Authentication.DefaultCredentials = new System.Net.NetworkCredential("username", "password");
                        client1.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e)
                        {
                            e.AcceptedFailures = e.Failures;
                            e.Save = true;
                        };
                        System.Collections.ObjectModel.Collection<svnlogeventargs> logEntries;
                        var logArgs = new SvnLogArgs {Limit = 1};
                        client1.GetLog(repository1, logArgs, out logEntries);
                    }

                    var arg = new SvnCopyArgs {LogMessage = "error"};
                    var target = new SvnUriTarget(new Uri(txtURL.Text));

                    client.CheckOut(target, repositoryPath);

                }
</svnlogeventargs>


这篇关于一个用C#从svn检出源代码的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆