commit f028bff0691802dddaff55649cc1a1ef54a14b8e Author: Eugen Höglinger Date: Thu Feb 27 15:05:42 2020 +0100 Projekt neu angelegt. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a5f80a --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ + +#Ignore thumbnails created by Windows +Thumbs.db +#Ignore files built by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +.vs/ +#Nuget packages folder +packages/ diff --git a/IncrementAssemblyVersion.sln b/IncrementAssemblyVersion.sln new file mode 100644 index 0000000..4c55f0d --- /dev/null +++ b/IncrementAssemblyVersion.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IncrementAssemblyVersion", "IncrementAssemblyVersion\IncrementAssemblyVersion.csproj", "{2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {43E7A9A6-9F56-4186-AA5D-37D27AB405AE} + EndGlobalSection +EndGlobal diff --git a/IncrementAssemblyVersion/App.config b/IncrementAssemblyVersion/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/IncrementAssemblyVersion/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/IncrementAssemblyVersion/IncrementAssemblyVersion.csproj b/IncrementAssemblyVersion/IncrementAssemblyVersion.csproj new file mode 100644 index 0000000..f811bbd --- /dev/null +++ b/IncrementAssemblyVersion/IncrementAssemblyVersion.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0} + Exe + IncrementAssemblyVersion + IncrementAssemblyVersion + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IncrementAssemblyVersion/Program.cs b/IncrementAssemblyVersion/Program.cs new file mode 100644 index 0000000..a5fa3c1 --- /dev/null +++ b/IncrementAssemblyVersion/Program.cs @@ -0,0 +1,110 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; + + +namespace IncrementAssemblyVersion +{ + class Program + { + private const int MaxBuildVersion = 999; + private static string AssemblyVersionPattern = + "\\[(?:\\s+)?assembly(?:\\s+)?:(?:\\s+)?AssemblyVersion(?:\\s+)?\\(\"(?:\\s +)?(\\d+).(\\d+).(\\d+).(\\d+)\"(?:\\s+)?\\)(?:\\s+)?\\]"; + + + static int Main(string[] args) + { + if (args == null || args.Length == 0) + { + Console.WriteLine("Syntax: IncrementAssemblyVersion.exe [root path of you solution]"); + return 1; + } + + + string applicationRootPath = args[0]; // @"D:\Desktop\IncrementAssemblyVersion\IncrementAssemblyVersion\"; + string pathAssemblyInfo = Path.Combine(applicationRootPath, @"Properties\", "AssemblyInfo.cs"); + + + Console.WriteLine("----------------------------------------------------"); + Console.WriteLine("------------- IncrementAssemblyVersion -------------"); + Console.WriteLine("----------------------------------------------------"); + Console.WriteLine("Path to solution: '" + applicationRootPath + "'"); + Console.WriteLine("File path: '" + pathAssemblyInfo + "'"); + + + FileInfo info = new FileInfo(pathAssemblyInfo); + if (info.Exists) + { + bool removedReadOnlyFlag = false; + if (info.IsReadOnly) + { + Console.WriteLine("Remove ReadOnly Flag"); + + + removedReadOnlyFlag = true; + File.SetAttributes(info.FullName, File.GetAttributes(info.FullName) & ~FileAttributes.ReadOnly); + } + + + string[] lines = File.ReadAllLines(info.FullName); + for (int i = 0; i MaxBuildVersion) + { + minor++; + build = 0; + } + + + Console.WriteLine($" to {major}.{minor}.{build}.{revision}"); + + + string newLineContent = $"[assembly: AssemblyVersion(\"{major}.{minor}.{build}.{revision}\")]"; + lines[i] = lines[i].Replace(assemblyVersionMatch.Value, newLineContent); + } + } + + + Console.WriteLine("Save file"); + File.WriteAllLines(pathAssemblyInfo, lines); + + + if (removedReadOnlyFlag) + { + Console.WriteLine("Set ReadOnly flag"); + File.SetAttributes(pathAssemblyInfo, File.GetAttributes(pathAssemblyInfo) | FileAttributes.ReadOnly); + } + + + return 0; + } + else + { + Console.WriteLine($"Cannot find the assembly info file '{pathAssemblyInfo}'"); + return 1; + } + } + } + } diff --git a/IncrementAssemblyVersion/Properties/AssemblyInfo.cs b/IncrementAssemblyVersion/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b6cc9e5 --- /dev/null +++ b/IncrementAssemblyVersion/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("IncrementAssemblyVersion")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("IncrementAssemblyVersion")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("2578ad3e-7e8c-4478-aec5-2fcd5a8f52a0")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]