diff --git a/ATxCommon/ATxCommon.csproj b/ATxCommon/ATxCommon.csproj index 356e5ccf312ab27fe2601da1a3a92e9477afe135..1b951b8dedc57d52802e93c1953660b339c4cd1b 100644 --- a/ATxCommon/ATxCommon.csproj +++ b/ATxCommon/ATxCommon.csproj @@ -68,6 +68,9 @@ <PropertyGroup> <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent> </PropertyGroup> + <PropertyGroup> + <PostBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Post-Build-Script.ps1 -SolutionDir $(SolutionDir)</PostBuildEvent> + </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/ATxDiagnostics/ATxDiagnostics.csproj b/ATxDiagnostics/ATxDiagnostics.csproj index bab54c8572711b17b09acfe0bb8f003b26107003..f55138dc60421faf7a11c1f7b42917096696c463 100644 --- a/ATxDiagnostics/ATxDiagnostics.csproj +++ b/ATxDiagnostics/ATxDiagnostics.csproj @@ -69,4 +69,7 @@ <PropertyGroup> <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent> </PropertyGroup> + <PropertyGroup> + <PostBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Post-Build-Script.ps1 -SolutionDir $(SolutionDir)</PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file diff --git a/ATxService/ATxService.csproj b/ATxService/ATxService.csproj index 968226f3d2a4b1f3deb1d96c7031b951b6db1b77..7f29069a6ebc40bf16272ed1de1bbbe01541fc6e 100644 --- a/ATxService/ATxService.csproj +++ b/ATxService/ATxService.csproj @@ -171,8 +171,7 @@ <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent> </PropertyGroup> <PropertyGroup> - <PostBuildEvent> - </PostBuildEvent> + <PostBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Post-Build-Script.ps1 -SolutionDir $(SolutionDir)</PostBuildEvent> </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. diff --git a/ATxTray/ATXTray.csproj b/ATxTray/ATXTray.csproj index f5ef4c711adfe86c2a503d8b572194e801a722bf..ca6e1870e2c0a04459c24bfdadd432d7574b5128 100644 --- a/ATxTray/ATXTray.csproj +++ b/ATxTray/ATXTray.csproj @@ -116,8 +116,7 @@ <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Prepare-Build.ps1 -SolutionDir $(SolutionDir) -ConfigurationName $(ConfigurationName)</PreBuildEvent> </PropertyGroup> <PropertyGroup> - <PostBuildEvent> - </PostBuildEvent> + <PostBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)Scripts\Post-Build-Script.ps1 -SolutionDir $(SolutionDir)</PostBuildEvent> </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. diff --git a/Scripts/Post-Build-Script.ps1 b/Scripts/Post-Build-Script.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..9b9d7d95d57abbf3568ebff8fb3130c53e6e5a02 --- /dev/null +++ b/Scripts/Post-Build-Script.ps1 @@ -0,0 +1,22 @@ +<# +.DESCRIPTION +This script is intended to be executed as a "post-build" command in Visual Studio. +It reverts changes made to specific files during the build process, ensuring they +remain consistent with their pre-build state. + +Currently, it targets the "BuildDetails.cs" file within the "ATxCommon" +directory of the specified solution. +#> + +[CmdletBinding(DefaultParameterSetName="build")] +Param( + [Parameter(Mandatory=$True, ParameterSetName="build")] + [Parameter(Mandatory=$True, ParameterSetName="gentemplate")] + [string] $SolutionDir +) + +try { + git checkout -- "$($SolutionDir)\ATxCommon\BuildDetails.cs" +} catch { + Write-Error "Git checkout failed. Is Git installed? File was not reset: $($SolutionDir)\ATxCommon\BuildDetails.cs" +}