none
Unmanaged Dll's RRS feed

  • Question

  • Hi,

    I have to use in my application unmanaged dll's, but I have to use a debug version of unmanaged dll when I am building the debug version of my application and a release version of unmanaged dll when I am building the release version of app. In C++ projects it is easy to achieve by overriding PATH environment variable for each Debug or Release version of the project. How can I accomplish this in C# project?

    Thanks in advance.
    Thursday, June 5, 2008 6:16 AM

Answers

  • Just copy the debug build of the DLL into the bin\debug folder of your C# project.  Same scenario for the release build.  That will also help you to avoid having to locate these DLLs in a folder on the path.  To do it automatically, use an xcopy.exe command in the prebuild event.  You can use the $(ConfigurationName) and $(TargetDir) macros to copy the right DLL into the right folder.
    Hans Passant.
    Thursday, June 5, 2008 12:05 PM
    Moderator

All replies

  • Just copy the debug build of the DLL into the bin\debug folder of your C# project.  Same scenario for the release build.  That will also help you to avoid having to locate these DLLs in a folder on the path.  To do it automatically, use an xcopy.exe command in the prebuild event.  You can use the $(ConfigurationName) and $(TargetDir) macros to copy the right DLL into the right folder.
    Hans Passant.
    Thursday, June 5, 2008 12:05 PM
    Moderator
  • Yes, it's an option, but size of all dll's which I have to copy is over 300 MB, it's take too long. Maybe there is some another solution? 
    Thursday, June 5, 2008 12:07 PM
  • You only need to copy them once.  The xcopy.exe /d command line switch takes care of that.
    Hans Passant.
    Thursday, June 5, 2008 12:18 PM
    Moderator
  • xmm... I thought there is some more neat solution. I will do like you said. Thanks!
    Thursday, June 5, 2008 12:23 PM