1

I'am using SharpSvn to connect to an SVN server . I would like to get the content of a file or to copy it my disk just by using it Uri on the server. Does SharpSVN API offers this functionality. if it is, how ? thanks.

example of Uri : https://svn.myproject.com/svn/Projet/file.pdf
AtefB
  • 171
  • 1
  • 3
  • 16

1 Answers1

1

See How to checkout a specific file in repository using sharpsvn API?

Uri from = new Uri("https://svn.myproject.com/svn/Projet/file.pdf");

using (SvnClient client = new SvnClient())
{
    using (var fs = File.Create(Path.GetFileName(from.LocalPath))) {
        client.Write(SvnTarget.FromUri(from), fs);
    }
}
Community
  • 1
  • 1
soumasandesu
  • 301
  • 2
  • 10
  • ok great it works thank you. But how can i tell it where to copy the file ? – AtefB Apr 24 '15 at 13:54
  • Set on the method call `File.Create(string)`. In this example that would be the [startup path](https://msdn.microsoft.com/en-gb/library/system.windows.forms.application.startuppath%28v=vs.110%29.aspx) (usually be the same path of the executable). You may specify where to save the file yourself. – soumasandesu Apr 24 '15 at 22:03