Projekt neu angelegt.

This commit is contained in:
Eugen Höglinger 2020-02-27 15:05:42 +01:00
commit f028bff069
6 changed files with 262 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@ -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/

View File

@ -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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2578AD3E-7E8C-4478-AEC5-2FCD5A8F52A0}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>IncrementAssemblyVersion</RootNamespace>
<AssemblyName>IncrementAssemblyVersion</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -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<lines.Length; i++)
{
if (lines[i].Trim().StartsWith("//"))
{
continue;
}
var assemblyVersionMatch = Regex.Match(lines[i], AssemblyVersionPattern);
if (assemblyVersionMatch.Success && assemblyVersionMatch.Groups.Count == 5)
{
Console.WriteLine($"Match for AssemblyVersion found on line {i + 1}");
int major = Convert.ToInt32(assemblyVersionMatch.Groups[1].Value);
int minor = Convert.ToInt32(assemblyVersionMatch.Groups[2].Value);
int build = Convert.ToInt32(assemblyVersionMatch.Groups[3].Value);
int revision = Convert.ToInt32(assemblyVersionMatch.Groups[4].Value);
Console.Write($"Change Version from {major}.{minor}.{build}.{revision}");
build++;
if (build > 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;
}
}
}
}

View File

@ -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")]