|
#1
|
|||
|
|||
Passing a path as a macro to another project
I have a Visual Build Project that uses a temporary macro %SourceDir% to decide where the check data out to. This works fine if I run the project on its own. However if I try to call that VBP project from another and pass it the %SourceDir% macro from the parent project I get a messagebox that states "The system cannot find the specified file".
If I put some other value in that is not a directory it does not give me this messagebox but still fails because it is not a directory (expected). Here is the command line that is being called from the VBP project: "C:\Program Files\VisBuildPro\VisBuildPro.exe" "SourceDir=c:\develop\" /b "C:\develop\Visual Build Pro\FormsPartnerHelp.bld" How do I pass a directory as a macro? Thanks in advance, Eric Eicke |
#2
|
|||
|
|||
This is a result of a standard feature of command-line parameters. When a backslash char is followed by a double quote char, \" is treated as a literal quote (to allow the insertion of double quote characters rather treating as an end-of-parameter marker).
When actions such as the VisBuildPro Project action generate the command-line to be called, it wraps parameter values in double quotes so that if it contains spaces, the entire value will be treated as a single parameter. But if the parameter value happens to end with a backslash, it leads to the \" situation, and the remaining parameters get messed up since that double quote isn't treated as an end-of-parameter marker. In the next release, custom actions that generate commands will be fixed to only wrap with double quotes if a parameter actually contains spaces, and to change \" to \\" when a parameter does contain spaces and end in a backslash. For now, you can either remove the backslash from your macro value (and add after the places it is referenced) or add another double backslash so that the command ends up like: ... "SourceDir=c:\develop\\" ... |
|
|