Reputation: 3058
When debugging I need to start an external program from the target directory of a build and am wondering if it can be accomplished using relative paths.
As a post-build event I have the following:
IF NOT "$(ConfigurationName)"=="Debug" GOTO End :CopyExecutable copy "$(SolutionDir)\Source\Lib\MyExecutable.exe" "$(TargetDir)" :End
I need to run MyExecutable.exe when I am debugging so in the debug tab for the project properties I set "Start external program" to MyExecutable.exe but get a failure when running the debug. It seems I need to put the full path for this to work.
Is there a way to do this using relative paths?
Upvotes: 4
Views: 4929
Reputation: 1045
The 'Start External Program' path is relative to your solution directory (in VS2005 anyway). So you could just put:
Source\Lib\MyExecutable.exe
I see you asked this a while ago, but I just ran into the same problem, and this is how I solved it.
Upvotes: 5
Reputation: 15935
(_Disclaimer: all directions are based on VS08. Things may be in different places in prior or future versions)
I get the feeling that your other program is not a post-build step you need to run before debugging, but rather a program that also needs to run (a server or something) aswell while you debug.
Use an empty C++ Make-File project (you can use other project types, but this one by default does no actual building, so I find it's the easiest), and alter its start-up properties (Project/Properties -> Debug) to run your other application. Then, set your solution to start multiple projects (Solution/Properties -> Common Properties -> Startup Project).
Upvotes: 2