The best resources for developers

Can you use SVN Revision to label build in CCNET?

using System;
using System.Diagnostics;

namespace SvnRevisionNumberParserSample
    class Program
        static void Main()
            Process p = Process.Start(new ProcessStartInfo()
                    FileName = @"C:Program FilesSlikSvninsvn.exe", // path to your svn.exe
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    Arguments = "info --revision HEAD",
                    WorkingDirectory = @"C:MyProject" // path to your svn working copy

            // command "svn.exe info --revision HEAD" will produce a few lines of output

            // our line starts with "Revision: "
            while (!p.StandardOutput.EndOfStream)
                string line = p.StandardOutput.ReadLine();
                if (line.StartsWith("Revision: "))
                    string revision = line.Substring("Revision: ".Length);
                    Console.WriteLine(revision); // show revision number on screen                       


Tags: svn msbuild

Source: By hitec as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0

Related code-snippets: