如何使用WPF单击一次应用程序部署非托管DLL?
我有一个使用非托管dll的WPF单击一次应用程序。
I have a WPF click-once application that makes use of an unmanaged dll.
在本地调试时,我只是将dll复制到了debug / bin文件夹中。
When debugging locally I have just copied the dll into the debug/bin folder.
如何将dll包含在项目(VS2010)中,以便它可以部署并可供应用程序访问?
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.
如果有帮助,这是我用来访问非托管DLL中的方法的代码示例。
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);
而不是经历整个添加资源过程-我只需要将添加现有项添加到项目的根文件夹中,然后设置内容和始终复制。
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".