Automate version set from git revision.

This commit is contained in:
2018-04-12 00:20:29 +01:00
parent 64647ed5fd
commit 6df96ccc96
21 changed files with 170 additions and 35 deletions

View File

@@ -12,13 +12,18 @@
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFramework>net461</TargetFramework>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>4.0.99.1628</Version>
<Version>4.0.99.1629</Version>
<Company>Claunia.com</Company>
<Copyright>Copyright © 2011-2018 Natalia Portillo</Copyright>
<Copyright>Copyright © {copyright:2011} Natalia Portillo</Copyright>
<Product>The Disc Image Chef</Product>
<Title>The Disc Image Chef</Title>
<ApplicationVersion>$(Version)</ApplicationVersion>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
@@ -265,5 +270,6 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.2-beta" />
</ItemGroup>
</Project>

View File

@@ -211,12 +211,13 @@ namespace DiscImageChef
object[] attributes =
typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
string assemblyTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
attributes =
typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
Version assemblyVersion = typeof(MainClass).Assembly.GetName().Version;
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
AssemblyInformationalVersionAttribute assemblyVersion =
Attribute.GetCustomAttribute(typeof(MainClass).Assembly, typeof(AssemblyInformationalVersionAttribute))
as AssemblyInformationalVersionAttribute;
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
DicConsole.WriteLine("{0} {1}", assemblyTitle, assemblyVersion);
DicConsole.WriteLine("{0} {1}", assemblyTitle, assemblyVersion?.InformationalVersion);
DicConsole.WriteLine("{0}", assemblyCopyright);
DicConsole.WriteLine();
}