From a4c27589e74e517f4f369ed1a14104469a2e384a Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Mon, 12 Mar 2018 16:23:41 +0100
Subject: [PATCH] Provide assembly version info from build.

---
 ATxDiagnostics/ATxDiagnostics.csproj      |  3 +++
 ATxDiagnostics/Properties/AssemblyInfo.cs | 14 +++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ATxDiagnostics/ATxDiagnostics.csproj b/ATxDiagnostics/ATxDiagnostics.csproj
index f38bdad..140cd0f 100644
--- a/ATxDiagnostics/ATxDiagnostics.csproj
+++ b/ATxDiagnostics/ATxDiagnostics.csproj
@@ -66,4 +66,7 @@
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent>
+  </PropertyGroup>
 </Project>
\ No newline at end of file
diff --git a/ATxDiagnostics/Properties/AssemblyInfo.cs b/ATxDiagnostics/Properties/AssemblyInfo.cs
index 8aa9c84..31539f5 100644
--- a/ATxDiagnostics/Properties/AssemblyInfo.cs
+++ b/ATxDiagnostics/Properties/AssemblyInfo.cs
@@ -1,6 +1,6 @@
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using ATxCommon;
 
 // General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
@@ -32,5 +32,13 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion(BuildDetails.GitMajor + "." +
+                           BuildDetails.GitMinor + "." +
+                           BuildDetails.GitPatch + ".0")]
+[assembly: AssemblyFileVersion(BuildDetails.GitMajor + "." +
+                               BuildDetails.GitMinor + "." +
+                               BuildDetails.GitPatch + ".0")]
+
+[assembly: AssemblyInformationalVersion(BuildDetails.BuildDate +
+                                        " " + BuildDetails.GitCommit +
+                                        " (" + BuildDetails.GitBranch + ")")]
\ No newline at end of file
-- 
GitLab