Visual Studio pre-build & post-build commands for DukeBlaze Launcher #2
Stumpy842
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since DukeBlaze Launcher only works properly when running from the eduke32 folder, I have added these commands to the VS project for pre-build and post-build.
Pre-build event command line:
PowerShell -Command KillWindow.ps1 'DukeBlaze Launcher'
Post-build event command line:
copy /Y $(TargetPath) E:\Games\DUKE3D
E:
cd \Games\DUKE3D
call $(TargetName)
Note for the post-build you will need to change the Drive and path appropriate to your environment.
Contents of KillWindow.ps1:
param(
[string]$a
)
$windowTitle = $a
$window = Get-Process | Where-Object { $_.MainWindowTitle -eq $windowTitle }
if ($window) {
Stop-Process -Id $window.Id
} else {
Write-Output "No window found with title '$windowTitle'"
}
Copy the script above to KillWindow.ps1 and place it in a folder in your path. Now when you build the solution it will automatically search for and close the running DukeBlazeLauncher.exe if found, and launch the app from the correct directory after a successful build.
I hope this helps someone since it could easily be adapted to any solution where the application needs to be run (tested) from a specific folder.
Beta Was this translation helpful? Give feedback.
All reactions