From d0d9059c0419cd1ec5319db403571049776e6973 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Tue, 27 Feb 2018 22:43:09 +0100
Subject: [PATCH] Put BuildDetails.cs in ATxCommon instead of having it shared.

The shared approach results in conflicts if the generated class is used
in ATxCommon which is imported in the other projects. This way we can
use the symbols defined via ATxCommon in all depending projects.

The downside is that it slows down the build-process a bit as every
build from a project depending on ATxCommon (read: all others) will
change the generated code and thus force a re-build of ATxCommon and
the project itself. Since building the entire solution is still just
a matter of seconds, that's a fair trade-off.
---
 ATxCommon/ATxCommon.csproj               | 4 ++++
 {Resources => ATxCommon}/BuildDetails.cs | 0
 ATxService/ATxService.csproj             | 3 ---
 AutoTx.sln                               | 1 -
 Scripts/Prepare-Build.ps1                | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
 rename {Resources => ATxCommon}/BuildDetails.cs (100%)

diff --git a/ATxCommon/ATxCommon.csproj b/ATxCommon/ATxCommon.csproj
index aee0a69..213dcb1 100644
--- a/ATxCommon/ATxCommon.csproj
+++ b/ATxCommon/ATxCommon.csproj
@@ -47,6 +47,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ActiveDirectory.cs" />
+    <Compile Include="BuildDetails.cs" />
     <Compile Include="Conv.cs" />
     <Compile Include="FsUtils.cs" />
     <Compile Include="NLog\RateLimitWrapper.cs" />
@@ -61,6 +62,9 @@
     <None Include="packages.config" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent>
+  </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
diff --git a/Resources/BuildDetails.cs b/ATxCommon/BuildDetails.cs
similarity index 100%
rename from Resources/BuildDetails.cs
rename to ATxCommon/BuildDetails.cs
diff --git a/ATxService/ATxService.csproj b/ATxService/ATxService.csproj
index 41c55ad..d8a2c52 100644
--- a/ATxService/ATxService.csproj
+++ b/ATxService/ATxService.csproj
@@ -78,9 +78,6 @@
     <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/AutoTx.sln b/AutoTx.sln
index 395272b..920d1a1 100644
--- a/AutoTx.sln
+++ b/AutoTx.sln
@@ -19,7 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		Resources\BuildCommit.txt = Resources\BuildCommit.txt
 		Resources\BuildConfiguration.txt = Resources\BuildConfiguration.txt
 		Resources\BuildDate.txt = Resources\BuildDate.txt
-		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/Scripts/Prepare-Build.ps1 b/Scripts/Prepare-Build.ps1
index 5495f40..66366ef 100644
--- a/Scripts/Prepare-Build.ps1
+++ b/Scripts/Prepare-Build.ps1
@@ -100,7 +100,7 @@ $DateShort = Get-Date -Format 'yyyy.MM.dd.HHmm'
 $BCommit = "$($SolutionDir)\Resources\BuildCommit.txt"
 $BuildDate = "$($SolutionDir)\Resources\BuildDate.txt"
 $BuildConfig = "$($SolutionDir)\Resources\BuildConfiguration.txt"
-$BuildDetailsCS = "$($SolutionDir)\Resources\BuildDetails.cs"
+$BuildDetailsCS = "$($SolutionDir)\ATxCommon\BuildDetails.cs"
 
 
 $Date | Out-File $BuildDate
-- 
GitLab