如何使用WPF单击一次应用程序部署非托管DLL? [英] How can I deploy an unmanaged DLL with a WPF click-once application?

查看:78
本文介绍了如何使用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".

这篇关于如何使用WPF单击一次应用程序部署非托管DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆