I have the following as my post-build event in a C# .NET 4.0 project in Visual Studio 2010:
call "$(SolutionDir)Publish\Publish.exe" "$(TargetDir)" "\\lithium\c\Photon"
call "$(SolutionDir)RemoteControl\RemoteControl.exe" start
The problem is that when Publish.exe is executed, there is only one command line argument being passed, which contains the following value:
C:\Users\...\bin\Release" \\lithium\c\Photon
note: I replaced some folders with an ellipsis, otherwise this is the exact value
For whatever reason, it's combining the two arguments into one, and parsing the quotes very strangely. I've been debugging this for awhile, and I've tried it without the call
, with a relative directory to Publish.exe
, with something as simple as call "$(SolutionDir)Publish\Publish.exe" hello world
and it's always smashed into a single argument. This leads me to believe that it's not some quotation tomfoolery.
If I run this exact same program from the prompt, it works flawlessly. Someone, please help me cut through this madness.
While working on another project, I actually managed to replicate your problem. I was passing multiple args to a powershell script and found that they were being treated as a single argument. Googling found this link
http://davidfrette.wordpress.com/2011/01/20/creating-powershell-pre-build-and-post-build-events-for-visual-studio-projects/
Which has the solution of putting a space at the end of the first parameter i.e. in your example it would be
call "$(SolutionDir)Publish\Publish.exe" "$(TargetDir) " "\\lithium\c\Photon"
This worked for me so hopefully it will fix your problem.
If you have more than 2 args then you would need to add a space at the end of each except for the last one.
HTH
I hit the same problem - if the argument expands out to something which ends in a backslash, I think the second quote is being escaped and treated as a quote character within the first argument.
Using "$(OutDir)\" worked for me.
I'm not getting this behaviour at all.
I created a post-build event of
call "$(SolutionDir)test.cmd" "$(SolutionDir)a.txt" "$(SolutionDir)b.txt"
Where test.cmd contains:
if '%1' == '' GOTO END
notepad.exe %1
if '%2' == '' GOTO END
notepad.exe %2
:END
a.txt & b.txt just have "This is File A" & "This is File B"
When I do the build, Notepad fires up with a.txt, and when I close it then Notepad fires up with b.txt.
So the parameters are definitely being sent separately for me.
Can you try this same test to see what behaviour you get?