Reputation: 15
I am trying to export files or folders from SVN using c#. I used the SharpSvn lib.
SharpSvn.SvnClient svnclient = new SvnClient();
svnclient.Export(new SvnUriTarget(source), target, new SvnExportArgs());
I have been trying to export the source to directory. It is successful(If folder doesn't exists)
But If the folder exists it throws the following error
SharpSvn.SvnObstructedUpdateException: 'E:\abc\SVN\SVNtest' already exists
In the command line,
svn --force export
will work
but for C#, what is the class or method I have to use to overwrite the existing folder.
I don't want to call any bat file or vbscript because I want to handle all the errors or exceptions in c# only.
Upvotes: 1
Views: 1126
Reputation: 28154
The documentation is a bit thin, but have you looked at the Overwrite
property of SVNExportArgs
?
SharpSvn.SvnClient svnclient = new SvnClient();
SvnExportArgs ex = new SvnExportArgs();
ex.Overwrite = true;
svnclient.Export(new SvnUriTarget(source), target, ex);
I haven't tested this, so I may be completely off the mark, but it seems logical.
Upvotes: 2