locked
How to move referenced libraries (DLLs) to probing folder (privatePath) RRS feed

  • Question

  • I have developed an windows application in .NET 4.0 in app.config I have added <probing> to keep referenced DLL into separate folder.

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="lib;"/>
        </assemblyBinding>
     </runtime>

    Now when I build the project (Debug/Release mode) through VS2010 all the referenced DLLs are copied to the application's startup directory (parallel to executable), I want this should be copied to probing private path i.e lib.

    What changes need to be done to automatically copy all references to probing path? Currently I am doing this by writing post-build event but problem is I am using XCOPY command to copy all the referenced DLLs to lib folder so every time when a reference get added I have to write that file name in XCOPY command.
    Friday, January 29, 2016 5:36 PM

Answers

  • Use the Post-built event.

    1. Right click on your project and open the "Properties".

    2. In Project properties window click on the "Build events" (Left side)

    3. In this window, you can see the option "Post-event build command line" textbox. Use below code in that textbox.

        copy /B /Y "$(TargetDir)*.dll" "$(SolutionDir)bin\Release\lib"

    4. Set the "Run post build-event" to "on successful build."

    now, rebuild your project. This will copy all your DLL into Release\Lib folder. If you want you can hardcode the path.

    Friday, January 29, 2016 8:05 PM

All replies

  • There's no automatic way to do this afaik.

    You could copy all the dll using a for in the post build, something like:

    for /R c:\blaa %%f in (*.dll) do copy %%f x:\lib\


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Friday, January 29, 2016 7:11 PM
  • Use the Post-built event.

    1. Right click on your project and open the "Properties".

    2. In Project properties window click on the "Build events" (Left side)

    3. In this window, you can see the option "Post-event build command line" textbox. Use below code in that textbox.

        copy /B /Y "$(TargetDir)*.dll" "$(SolutionDir)bin\Release\lib"

    4. Set the "Run post build-event" to "on successful build."

    now, rebuild your project. This will copy all your DLL into Release\Lib folder. If you want you can hardcode the path.

    Friday, January 29, 2016 8:05 PM