how to change the location that the references dlls are copied to?

后端 未结 3 530
挽巷
挽巷 2021-01-24 05:39

i am using some libraries and i added a reference to that library dll and i set the \"Copy Local\" to true.
but i want to change the location of the dll to be a subfolder in

相关标签:
3条回答
  • 2021-01-24 06:09

    Do you need it as a reference? Or is the reference only to copy the dll to the desired location?

    If you do not need the reference, try adding it to the project and setting it to always copy.

    Add the dll to a folder in the project and set to Copy to Output Directory http://web11.twitpic.com/img/146848312-ecfdeadf5b322fe755c7a764d6e6dbf0.4c69c2f0-full.png

    0 讨论(0)
  • 2021-01-24 06:14

    You'll need a .config file for your .exe so that the probing path is changed. A subdirectory is no problem, just use the <probing> element, its privatePath attribute is a relative folder name.

    Beware however that you'll get little help from the IDE to put the DLL in that spot. You'll need a post build event that creates the folder if necessary and xcopy's the DLL there. Something like this:

    if not exist "$(TargetDir)mumble" mkdir "$(TargetDir)mumble"
    xcopy /d /y "$(TargetDir)something.dll" "$(TargetDir)mumble"
    
    0 讨论(0)
  • 2021-01-24 06:27

    I don't know whether it's feasible within "normal" build rules, but you could add post-build steps which basically moved the files. It would be ugly, but it should work.

    0 讨论(0)
提交回复
热议问题