You’re in luck. It’s a bug in UpdateVersion that the pin
doesn’t always work. Sorry. But here’s something that you can use until
then… Just add this code to a target and it will update any file
that you add to the array in the code. Don’t forget to update the
index of the array. Rick Casey ___________________________ Octane8 Platform Development Manager Sungard Workflow Solutions (205) 408-3615 |
<script language="C#"> <imports> <import name="System.Globalization" /> <import name="System.Threading" /> </imports> <code> <![CDATA[ public static void ScriptMain(Project project) { Version version = new Version(project.Properties["project.build.version"]); int major = version.Major; int minor = version.Minor; int build = version.Build; int revision = version.Revision; if (build == -1) { DateTime start = Convert.ToDateTime(project.Properties["startdate"]); Calendar calendar = Thread.CurrentThread.CurrentCulture.Calendar; int months = ((calendar.GetYear(DateTime.Today) - calendar.GetYear(start)) * 12) + calendar.GetMonth(DateTime.Today) - calendar.GetMonth(start); int day = DateTime.Now.Day; build = (months * 100) + day; } if (revision == -1) { TimeSpan difference = DateTime.Now.Subtract(DateTime.Today); revision = (int)(difference.TotalSeconds / 10); } //version = new Version(major, minor, build, revision); version = new Version(major, minor, build, revision); project.Properties["project.build.version"] = version.ToString();
// ADD NUMBER OF FILES HERE -----------\/ string[] filenames = new string[1]; // ADD YOUR FILES HERE filenames[0] = @"src\dll\Octigon.Octane8\AssemblyInfo.cs"; foreach (string s in filenames) { string contents = string.Empty; using (System.IO.StreamReader sr = new System.IO.StreamReader(s)) { contents = sr.ReadToEnd(); } System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"(?<=[\<\[]assembly:[\s]*?assemblyversion\("")([\d\.\*]*?)(?=""\)[\]\>])", System.Text.RegularExpressions.RegexOptions.IgnoreCase); contents = regex.Replace(contents, version.ToString()); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(s)) { sw.Write(contents); } } } ]]> </code> </script>