Get latest from SVN using C#

There is a simple utility available on internet, to integrate SVN with C#, i.e. SharpSVN.

This lets you do various things from C# code, that you would do using AnkhSVN or from windows explorer.

Example, to get the latest from SVN.

usi


ng System.Net;
using SharpSvn;
public class SharpSVNSample
{
    public void GetLatest()
    {
        using (SvnClient client = new SvnClient())
        {
            //Set the SVN credential
            client.Authentication.DefaultCredentials = CredentialCache.DefaultCredentials;
            // Checkout the code to the specified directory
            client.CheckOut(new Uri("https://svnserver.com/project/trunk/Development/Code/"),
                                    @"D:\Code");

            // Update the specified working copy path to the head revision
            client.Update(@"D:\Code");
        }
    }
}

Now, I would want to take the latest from SVN and publish the code.

So we can include the MSbuild commands after taking the latest from the SVN and then publish the code at a specified location and copy the output to a virtual directory if required.

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*