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

社会主义新天地 提交于 2019-11-30 15:22:47

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/6173501/how-can-i-deploy-an-unmanaged-dll-with-a-wpf-click-once-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!