views:

32

answers:

1

I set a prebuild event to:

$(TargetDir)MyConsoleApp

But when I run the application I get the following output:

------ Build started: Project: BlahBlahBlah, Configuration: Debug x86 ------

'd:\users\user\documents\visual' is not recognized as an internal or external 
command, operable program or batch file.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(902,9):
error MSB3073: The command "d:\users\user\documents\visual studio 2010\Projects\
BlahBlahBlah\BlahBlahBlah\bin\Debug\MyConsoleApp" exited with code 9009.

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

The file MyConsoleApp at the specified target DOES exist and runs properly from windows explorer.

+1  A: 

The TargetDir variable contains spaces in your case. You need to put quotes around the command:

"$(TargetDir)MyConsoleApp"
jeroenh
How do I include command-line args?
Shimmy
@Shimmy you add them after the command, outside of the quotes
jeroenh