Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I deploy an unmanaged DLL with a WPF click-once application?

Tags:

wpf

clickonce

I have a WPF click-once application that makes use of an unmanaged dll.

When debugging locally I have just copied the dll into the debug/bin folder.

How can I include the dll in the project (VS2010) so it is deployed and accessible to the application?

I have tried adding it as a Resource and setting "Content" and "Copy Always", and the file does seem to be present in the setup/deployment files, however the application is not able to see it.

If it helps, this is an example of the code I use to access the methods in the unmanaged DLL.

 [DllImport("ODBC_VER_DETECT.dll")]
 extern private static long GetCompanyFileVersion([MarshalAs(UnmanagedType.LPStr)] String sDataBase,
                                                 [MarshalAs(UnmanagedType.LPStr)] StringBuilder sVersion);
like image 960
dan Avatar asked May 30 '11 07:05

dan


1 Answers

Rather than going through the whole "Add Resource" rigmarole - I just needed to "Add existing item" into the root folder of the project and then set "Content" and "Copy Always".

like image 113
dan Avatar answered Nov 11 '22 15:11

dan