From 50d9ab06c1175581c12983138c54a4bf44635bb1 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Mon, 26 Feb 2018 14:11:58 +0100
Subject: [PATCH] Add infrastructure to include build-time information in
 assembly.

---
 ATxService/ATxService.csproj          | 3 +++
 ATxService/Properties/AssemblyInfo.cs | 8 ++++++--
 AutoTx.sln                            | 1 +
 Resources/BuildDetails.cs             | 6 ++++++
 4 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 Resources/BuildDetails.cs

diff --git a/ATxService/ATxService.csproj b/ATxService/ATxService.csproj
index b9c7e86..dc0462b 100644
--- a/ATxService/ATxService.csproj
+++ b/ATxService/ATxService.csproj
@@ -78,6 +78,9 @@
     <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="..\Resources\BuildDetails.cs">
+      <Link>BuildDetails.cs</Link>
+    </Compile>
     <Compile Include="AutoTx.cs">
       <SubType>Component</SubType>
     </Compile>
diff --git a/ATxService/Properties/AssemblyInfo.cs b/ATxService/Properties/AssemblyInfo.cs
index 0ae1c6a..f88ef9a 100644
--- a/ATxService/Properties/AssemblyInfo.cs
+++ b/ATxService/Properties/AssemblyInfo.cs
@@ -4,12 +4,12 @@ using System.Runtime.InteropServices;
 // General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("AutoTx")]
+[assembly: AssemblyTitle("AutoTx Service")]
 [assembly: AssemblyDescription("Automatic Background Transfer Service")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("IMCF, Biozentrum, University of Basel")]
 [assembly: AssemblyProduct("AutoTx")]
-[assembly: AssemblyCopyright("Copyright ©  2018")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -33,3 +33,7 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly: AssemblyInformationalVersion(BuildDetails.GitCommitName +
+                                        " @ " + BuildDetails.GitBranch +
+                                        " (" + BuildDetails.BuildDate + ")")]
diff --git a/AutoTx.sln b/AutoTx.sln
index 27d54e8..3e1f6d9 100644
--- a/AutoTx.sln
+++ b/AutoTx.sln
@@ -16,6 +16,7 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E945C19-14E3-4FE8-9008-480D4EA57F45}"
 	ProjectSection(SolutionItems) = preProject
 		Resources\auto-tx-logo.png = Resources\auto-tx-logo.png
+		Resources\BuildDetails.cs = Resources\BuildDetails.cs
 		Resources\Mail-Templates\DiskSpace-Low.txt = Resources\Mail-Templates\DiskSpace-Low.txt
 		Resources\Mail-Templates\Transfer-Interrupted.txt = Resources\Mail-Templates\Transfer-Interrupted.txt
 		Resources\Mail-Templates\Transfer-Success.txt = Resources\Mail-Templates\Transfer-Success.txt
diff --git a/Resources/BuildDetails.cs b/Resources/BuildDetails.cs
new file mode 100644
index 0000000..04fc388
--- /dev/null
+++ b/Resources/BuildDetails.cs
@@ -0,0 +1,6 @@
+public static class BuildDetails
+{
+    public const string GitCommitName = "?commit?";
+    public const string GitBranch = "?branch?";
+    public const string BuildDate = "?build time?";
+}
-- 
GitLab