简体   繁体   中英

Paths in Visual Studio post-build event

i have following problem: Because Visual Studio can't handle chain references, i need to copy all "chain reference"-DLLs to my program's bin-folder. For this, i use Robocopy.

The only problem is, that my command-line, i enter in Visual Studio post-build event is split incorrect.

ROBOCOPY "$(TargetDir)" "$(SolutionDir)Map\bin\$(ConfigurationName)\" *.dll /LOG:RCPY.log

This is my build event. All i get now is following:

Gestartet: Fri Jul 06 15:40:30 2012

Quelle : F:\Sicherung\Visual Studio\Projects\Map\Core\Core.GUI\bin\Release\ F:\Sicherung\Visual\
Ziel : F:\Sicherung\Visual Studio\Projects\Map\Core\Core.GUI\bin\Release\Studio\Projects\Map\Map\bin\Release\

Dateien : *.dll

Optionen: /COPY:DAT /R:1000000 /W:30

Whyever, it splits it at the empty space of "Visual Studio" in the second path/parameter. I tried everything with the quotes, but either Robocopy isn't executed (at least the log file doesn´t get overwritten) or the i get this log entry shown thereover...

And Visual Studio shows:

The command ... exited with code 16

which means there is a fatal error, mostly cause of invalid paths.

Unlike xcopy, robocopy treats \\" an escape character, as noted on http://ss64.com/nt/robocopy.html :

If either the source or desination are a "quoted long foldername" do not include a trailing backslash as this will be treated as an escape character, ie "C:\\some path\\" will fail but "C:\\some path\\" or "C:\\some path." or "C:\\some path" will work.

Since the trailing backslash is already included in post-build macros, you'll need to add a second backslash or a period to the end of your source and destination arguments:

ROBOCOPY "$(TargetDir)." "$(SolutionDir)Map\bin\$(ConfigurationName)\." *.dll /LOG:RCPY.log

I recommend adding the period, as this eliminates the escape character rather than work around it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM