6

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
SharpShade
  • 1,761
  • 2
  • 32
  • 45
  • 1
    Is that a .NET or C++ project? If .NET set *Copy Local* to *true* or use project references, then referenced assemblies will be copied automatically to your output folder. – Dirk Vollmar Jul 06 '12 at 13:59
  • "Because Visual Studio can´t handle chain references"? Can you explain, I never have to copy manually dll. – Steve B Jul 06 '12 at 13:59
  • Have you tried to debug paths using `echo " – abatishchev Jul 06 '12 at 14:02
  • Sorry. This is a .Net project. Copy Local doesnt work. I have one main project "Map". And subprojects called "Core.GUI" and so on. Core.GUI also references to third-party libraries like AvalonDock. Now if i build my whole solution, in the main project's bin-folder is only the "Core.GUI.dll" but not those DLLs which are referenced by it. Those libraries are only in "Core.GUI"'s bin-folder... And because of this, my project never works (FileNotFoundException is thrown)... How do i debug paths excatly? – SharpShade Jul 06 '12 at 14:15
  • Try the answers in this post: http://stackoverflow.com/questions/11587394/how-to-put-double-quotes-in-vs2010-post-build-step/12008312#12008312 – JoshL Aug 17 '12 at 15:07

1 Answers1

10

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, i.e. "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.

BradV
  • 565
  • 2
  • 8
  • 28
  • I'll keep that in mind, but I got it working a while after I asked (2012). Thanks, nonetheless. – SharpShade Mar 06 '15 at 16:40
  • 1
    I figured you weren't still looking for a solution, but I wanted to post this for anyone else having this issue (like I was). – BradV Mar 06 '15 at 18:36