dan
dan

Reputation: 5784

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

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);

Upvotes: 7

Views: 4223

Answers (1)

dan
dan

Reputation: 5784

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".

Upvotes: 9

Related Questions