Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programatically do file versioning with SVN and .NET?

Tags:

c#

.net

svn

c#-3.0

api

We have a report generator. Daily, it writes its data into a excel file.

For reasons of version controlling and file data safety, we need to alter this file, and commit the changes into a repository.

Do you recommend any .net SVN API you've used?

like image 740
Victor Rodrigues Avatar asked Apr 27 '09 20:04

Victor Rodrigues


2 Answers

You should take a look at the SharpSvn .NET library. You will probably need checkout and commit commands:

Checking out:

string wcPath = "c:\\my working copy";
using (SvnClient client = new SvnClient())
{
    client.CheckOut(new Uri("http://server/path/to/repos"), wcPath);
}

Committing:

string wcPath = "c:\\my working copy";
SvnCommitArgs a = new SvnCommitArgs();
a.LogMessage = "My log message";

using (SvnClient client = new SvnClient())
{
    client.Commit(wcPath, a);
}
like image 80
Sander Rijken Avatar answered Sep 19 '22 23:09

Sander Rijken


You might be able to turn on Autoversioning for your repository. Since it uses WebDAV, you can treat the repository just like a network drive (Web Folder). And you can treat the file as a normal file, just open, modify, and save.

If it were me , I would create a new repository for the excel data files. I don't think I'd like my code being autoversioned :)

like image 21
Steve K Avatar answered Sep 20 '22 23:09

Steve K