1

I have a VS2017 solution that Builds both locally and also on Azure DevOps.

I now need to run a Post Build script to run an EXE. I have this working on my local machine, but I guess there will be an issue with the Path to the EXE which has been added to the DevOps Library.

Note. The EXE is all installed on DevOps and runs fine from a Command Line Task - I just need it to run as a post build on one of the projects so that this project is ready to be packaged in the Installer SetUp project. (During a full Solution build).

This represents the Local Post Build script - How do I handle this on Azure, where the path will be different?

"C:\Program Files (x86)\{dir}\{app}.exe" -file "$(ProjectDir){file.txt}"

Any help appreciated. Thanks!

Dave P
  • 11
  • 3

1 Answers1

0

This represents the Local Post Build script - How do I handle this on Azure, where the path will be different?

$(ProjectDir) is msbuild property, so it works on both Azure DevOps and Local PC. You only need to pay attention to the {dir} of the xx.exe.

My suggestion is to put the exe in solution folder (where the xx.sln file exists), then you can use script like "$(SolutionDir)\{app}.exe" -file "$(ProjectDir){file.txt}". The $(SolutionDir) and $(ProjectDir) can be recognized by msbuild. (It works for both local pc and online devops.)

Or you can put the xx.exe under root directory of your git repo, then use $(System.DefaultWorkingDirectory) as the path of your xx.exe, but it only works for online devops, it can't work on local PC. (Not recommended)

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • Thanks, I'll give this a go, but I though the .exe to be executed needed to bin in the Library. I had this Command Line Task working - but this is not suitable as the build process is also packing the built projects into a WIX setup, and this needs to happen Post Build, but before creating the Set Up msi.: echo "Locking....." $(Agent.TempDirectory)\app.Console.exe -file "$(Build.Repository.LocalPath)\myProject\bin\Release\myApp.exe" -project "$(Build.Repository.LocalPath)\myProject\intellilock.ilproj" -destination "$(Build.Repository.LocalPath)\myProject\bin\Release\newDir\myApp_new.exe" – Dave P Jul 28 '20 at 18:12
  • Can msbuild property ``$(ProjectDir) work for your scenario? – LoLance Jul 31 '20 at 10:04