Are there any better ways to copy a native dll to the bin folder?

前端 未结 6 1056
别跟我提以往
别跟我提以往 2020-12-01 09:15

I have C# wrapper code that calls functions from a native (C++) dll. Currently, I can add a reference to the C# dll and have set the \'Copy Local\' option to true. However t

6条回答
  •  粉色の甜心
    2020-12-01 10:18

    If you're OK with the created "Libs" folder, you can try adding it to the probing path for your application, by adding the following in the app.config file:

    
       
          
             
          
       
    
    

    This will cause the runtime to look in all the specified directories for the DLL.

    EDIT Unfortunately, this does not impact the unmanaged DLL loading by DllImport.

提交回复
热议问题