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
p.WaitForExit();
// 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
break;
}
}
Console.Read();
}
}
}
Tags: svn cruisecontrol.net 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:
- How can I sync my SVN revision number with my ASP.NET web site?
- How do I upgrade my SQL Server database version?
- Best Practice: Collaborative Environment, Bin Directory, SVN, VB.NET. Best Practice: Collaborative Environment, Bin Directory, SVN, VB.NET. Web.Net.Best Practice: Collaborative Environment, Bin Directory, SVN.Web.Net. Best Practice: SBC, Bin Directory, SVN.Web.Net.
- CruiseControl.net, msbuild, /p:outputpath and CCNetArtifactDirectory.
- What do SVN results codes mean?
- How do I create branches?
- How does ASP.NET display SVN Revision Number.?
- How can I start using Version Control and Visual Studio?
- SVN Merge merged extra stuff. SVN merge can pull this stuff out.
- SVN Client Ignore Pattern for VB.NET Solutions and Design for SVN Client Ignore Pattern for VB.NET Solutions.
- Making a production build of a PHP project with Subversion?
- How do you deal with configuration files in source control?
- Fix fix svn checksum: Render SVN checksum for Repair!
- What are subversion hooks? What are some examples?
- The script sgen.exe fails on build 5.