Hello Spurtus,
I had the same problem and what I did was create a small console application
that would get the label from the environment variable set by CCNET and modify
the Assembly before the build process. (See Below)
Sameple Project Config:
<tasks>
<exec executable="C:\Program Files\CruiseControl.NET\server\MchpVersion.exe">
<buildArgs>"C:\CCNET\Build\RVIWorkingDir\RVI App\My
Project\AssemblyInfo.vb"</buildArgs>
</exec>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\CCNET\Build\RVIWorkingDir\RVI
App</workingDirectory>
<projectFile>RVI.vbproj</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Release /t:Rebuild
/v:diag</buildArgs>
<logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program
Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
Sample Code:
static void Main(string[] args)
{
string fileName = args[0].ToString();
string newVersionNumber =
Environment.GetEnvironmentVariable("CCNetLabel");
SetVersionString(newVersionNumber, fileName);
}
protected static void SetVersionString(string newVersionNumber, string
fileName)
{
string entireAttributeString = ReadTextFile(fileName);
string regexFormula = "(?!Assembly:
AssemblyVersion\\(\")(?:[0-9\\*]{1,5}\\.){3}[0-9\\*]{1,5}";
Regex regex = new Regex(regexFormula);
string newVersionString = regex.Replace(entireAttributeString,
newVersionNumber);
SaveTextFile(fileName, newVersionString);
}
protected static string ReadTextFile(string fileName)
{
string strContent = string.Empty;
using (StreamReader sr = new StreamReader(File.OpenRead(fileName),
true))
{
strContent = sr.ReadToEnd();
}
return strContent;
}
protected static void SaveTextFile(string fileName, string content)
{
File.SetAttributes(fileName, FileAttributes.Normal);
using (StreamWriter sw = new StreamWriter(fileName, false))
{
sw.Write(content);
}
}
----- Original Message ----
From: Spurtus <[email protected]>
To: ccnet-user <[email protected]>
Sent: Wed, April 28, 2010 3:03:48 AM
Subject: [ccnet-user] build publisher - link to files published?
What is the best way to have a link produced for any files ( in my
case jpgs ) that are published by the buildpublisher in the email or
web report?
Given that the buildpublisher publishes a directory I suppose just a
link to that would suffice but in the build log there is no mention of
where the publisher published files, I can;t see that I can write some
custom XSL to produce this?
Thanks,
Spurtus