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.
Right-click on the project node in Solution Explorer and select Properties. Expand the Build section, and select the Output subsection. Find the Base output path for C#, and type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead.
In the Post-build event command line box, specify the syntax of the build event. Add a call statement before all post-build commands that run . bat files. For example, call C:\MyFile.
In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.
Another way is to check the bin\debug dir for 'PreBuildEvent. bat' or 'PostBuildEvent. bat' which are the file that Visual Studio creates and run during the build events, if there is an error the files remain in the output dir and you can run them manually and spot the error.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With