Search code examples
c#.netvisual-studio-2013dllpost-build

For my class Library project in visual Studio 2013 ; Using post build event how do I copy the created dll to another path?


I have searched the net which has quite a few similar answers but they seem to differ with VS version. Each was differing so I though that I should ask you guys

So here is some detail.

i need to copy the dll at

"C:\MyProjects\Visual Studio\Mylibrary Library\Mylibrary \Mylibrary \bin\Release\Mylibrary.dll"

to

"C:\MyProjects\Unity\Projects\Valding\Valding\Assets\Classes\VadingClasses"

enter image description here


Solution

  • In your post-build event, give the following xcopy a shot...

    xcopy "$(ProjectDir)bin\Release\Mylibrary.dll" "C:\MyProjects\Unity\Projects\Valding\Valding\Assets\Classes\VadingClasses" /Y
    

    Here are some common switches used with xcopy, as well as the command syntax

    xcopy "your-source-path" "your-destination-path"
    
    • /I - treat as a directory if copying multiple files
    • /Q - Do not display the files being copied.
    • /S - Copy subdirectories unless empty.
    • /E - Copy empty subdirectories.
    • /Y - Do not prompt for overwrite of existing files.
    • /R - Overwrite read only files.

    Note that copy should work as well for you as well in this case, but xcopy should afford you some benefit if you wish to copy more than just a single file at some point. Check out these various further reading resources: