vs2008发布非托管dll问题
我有一组非托管 dll,它们周围有一个 C# 包装器,我从 C# 项目调用它们。 我添加了一个构建事件行,如下所示:
mkdir ..\Release
mkdir ..\Debug
copy ..\..\Includes\*.dll ..\Release\*.dll
copy ..\..\Includes\*.dll ..\Debug\*.dll
问题是,当我发布应用程序时,这些 dll 不包含在内,并且该发布比无用更糟糕,因为它创建了一个运行的应用程序,直到您调用其中之一那些dll。
那么,当我发布项目时如何包含非托管dll呢?
I have a collection of unmanaged dlls with a C# wrapper around them that I'm calling from a C# project. I've added a build event line that looks like:
mkdir ..\Release
mkdir ..\Debug
copy ..\..\Includes\*.dll ..\Release\*.dll
copy ..\..\Includes\*.dll ..\Debug\*.dll
Problem is, when I go to publish the application, those dlls aren't included, and the publication is worse than useless, since it creates an application that runs until you call one of those dlls.
So, how do I include unmanaged dlls when I publish the project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是:不要发布此内容,而是使用 Windows 安装程序, 如此处所述。
And the answer is: don't publish this, use the windows installer instead, as described here.
我目前正在调查同样的问题。 关于这个主题的文献确实非常少!
我能看到的唯一解决方案是将非托管 DLL 作为嵌入资源嵌入到程序集中,并在调用任何函数之前以编程方式将其提取到执行路径。
I'm currently investigating the same issue. The literature on the topic is very sparse indeed!
The only solution I can see is to embed the unmanaged DLL as an embedded resource inside the assembly, and programatically extract it out to the executing path before calling any functions.