From 7825593bc9a4c0810e812cd2088fd814f5e5001d Mon Sep 17 00:00:00 2001 From: Eugene Medvedev Date: Tue, 24 Jun 2014 20:04:44 +0400 Subject: [PATCH] There we go. :) --- BumpBuildNumber/BumpBuildNumber.cs | 25 ++++++++++++++ BumpBuildNumber/BumpBuildNumber.csproj | 40 ++++++++++++++++++++++ BumpBuildNumber/Properties/AssemblyInfo.cs | 27 +++++++++++++++ FormatterTests/FormatterTests.csproj | 2 +- RasterPropMonitor.sln | 6 ++++ RasterPropMonitor/RasterPropMonitor.csproj | 5 +++ SharedAssemblyInfo.cs | 9 ++--- 7 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 BumpBuildNumber/BumpBuildNumber.cs create mode 100644 BumpBuildNumber/BumpBuildNumber.csproj create mode 100644 BumpBuildNumber/Properties/AssemblyInfo.cs diff --git a/BumpBuildNumber/BumpBuildNumber.cs b/BumpBuildNumber/BumpBuildNumber.cs new file mode 100644 index 00000000..9bdfaf33 --- /dev/null +++ b/BumpBuildNumber/BumpBuildNumber.cs @@ -0,0 +1,25 @@ +using System.IO; +using System.Text.RegularExpressions; + +// This is a neat little idea I found of how to deal with the problem of non-incrementing file version on StackOverflow +// It has the advantage of not relying on a particular build system and being completely optional. + +namespace BumpBuildNumber +{ + class BumpBuildNumber + { + public static void Main(string[] args) + { + try { + string FILE = @"SharedAssemblyInfo.cs"; + string text = File.ReadAllText(FILE); + var regex = new Regex(@"(?\[assembly: AssemblyFileVersion\(""\d+\.\d+\.\d+\.)(?\d+)(?""\)\])"); + var match = regex.Match(text); + int buildNumber = int.Parse(match.Groups["BUILD"].Value) + 1; + string newText = regex.Replace(text, "${STATIC}" + buildNumber + "${TRAILER}", 1); + File.WriteAllText(FILE, newText); + } catch { + } + } + } +} diff --git a/BumpBuildNumber/BumpBuildNumber.csproj b/BumpBuildNumber/BumpBuildNumber.csproj new file mode 100644 index 00000000..98735692 --- /dev/null +++ b/BumpBuildNumber/BumpBuildNumber.csproj @@ -0,0 +1,40 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {059C7AF3-35D8-4F54-B1C9-8914E59CB5A6} + Exe + BumpBuildNumber + BumpBuildNumber + 0.17 + v3.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + true + + + true + ..\bin\Release + prompt + 4 + true + + + + + + + + + + \ No newline at end of file diff --git a/BumpBuildNumber/Properties/AssemblyInfo.cs b/BumpBuildNumber/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..862f5537 --- /dev/null +++ b/BumpBuildNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("BumpBuildNumber")] +[assembly: AssemblyDescription("A simple build utility to automate bumping build numbers without learning MSBuild tricks under Xamarin.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Eugene Medvedev")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/FormatterTests/FormatterTests.csproj b/FormatterTests/FormatterTests.csproj index 5216b3c5..4f8a81aa 100644 --- a/FormatterTests/FormatterTests.csproj +++ b/FormatterTests/FormatterTests.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {7FF5F186-3C9C-4E75-B71A-B0C248365D75} Exe diff --git a/RasterPropMonitor.sln b/RasterPropMonitor.sln index 86ccb5c0..0f480927 100644 --- a/RasterPropMonitor.sln +++ b/RasterPropMonitor.sln @@ -17,12 +17,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormatterTests", "Formatter EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MechJebRPM", "MechJebRPM\MechJebRPM.csproj", "{272BB11D-C8A8-4CA8-8C18-58324670C68C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BumpBuildNumber", "BumpBuildNumber\BumpBuildNumber.csproj", "{059C7AF3-35D8-4F54-B1C9-8914E59CB5A6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {059C7AF3-35D8-4F54-B1C9-8914E59CB5A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {059C7AF3-35D8-4F54-B1C9-8914E59CB5A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {059C7AF3-35D8-4F54-B1C9-8914E59CB5A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {059C7AF3-35D8-4F54-B1C9-8914E59CB5A6}.Release|Any CPU.Build.0 = Release|Any CPU {272BB11D-C8A8-4CA8-8C18-58324670C68C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {272BB11D-C8A8-4CA8-8C18-58324670C68C}.Debug|Any CPU.Build.0 = Debug|Any CPU {272BB11D-C8A8-4CA8-8C18-58324670C68C}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/RasterPropMonitor/RasterPropMonitor.csproj b/RasterPropMonitor/RasterPropMonitor.csproj index 98b7dd1a..214f3da9 100644 --- a/RasterPropMonitor/RasterPropMonitor.csproj +++ b/RasterPropMonitor/RasterPropMonitor.csproj @@ -31,6 +31,11 @@ 4 false 4 + + + + + diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index 21ac3da9..ca5dff75 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -15,10 +15,11 @@ [assembly: AssemblyVersion("0.17.0.0")] // Now this is the actual version number with build number. -// As I release newer ones, I'll bump them. Unfortunately I can't make automatic build number bumping -// without jumping through a lot of hoops. -// The 8888 is temporary here. -[assembly: AssemblyFileVersion("0.17.8888.0")] +// As I release newer ones, I'll bump them manually. +// The 8888 is temporary here to distinguish this from the last built dev build packet, +// as I release 0.17, I'll switch the version to 0.17. +// Build number is altered automatically. +[assembly: AssemblyFileVersion("0.17.8888.3")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing.