在设计时引用非托管DLL [英] Referencing unmanaged DLL at designtime

查看:72
本文介绍了在设计时引用非托管DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我想创建一个组件(Windows窗体)。

在这个组件中我需要从Wrapper-DLL访问方法。

每个时间我想这样做我得到的信息是找不到引用的DLL - 在DesignTime!

如果我在运行时使用相同的方法一切正常。



我需要一个建议......;)





额外[26.06.16] :

现在我更进了一步,也没有...

我从DLL(使用ILSpy)创建源代码并隔离其中一个更简单的方法。

现在我知道,问题来自DLLImport - 看起来这个命令只能在RunTime模式下工作而不能在DesignTime上工作。是否有办法解决问题?或者b $ b

我尝试了什么:



在Google上找到答案 - 没有成功...

解决方案

好的... 3天过去了很多尝试。

现在我有了解决方案。

在这种情况下(就像我描述的那样)DLL-File必须放在(例如)开发系统的目录中 - 这里\Program Files \ Microsoft Visual Studio \Common7 \IDE

似乎引擎在RunTime(DLL必须放在可执行目录中)和DesignTime之间有所区别......

I have a project where I want to create a Component (Windows Forms).
Inside this Component I need to access methods from a Wrapper-DLL.
Every time I want to do this I get the message that the referenced DLL could not be found - at DesignTime !
If I use the same methods at Runtime all works fine.

I need a Suggestion ... ;)


Additional [26.06.16] :
Now I am a step further and also not ...
I created the Source-Code from the DLL (with ILSpy) and isolated one of the easier methods from it.
Now I know, that the issue comes from DLLImport - it seem that this command only work at RunTime-mode and not at DesignTime. Is there any possibility for a work-around or another way to solve the problem ?

What I have tried:

Find an answer with Google - without success ...

解决方案

OK ... 3 days passed and many tries.
Now I have the solution.
In this case (like I described) the DLL-File must be placed (for example) in the Directory from the developing system - here "\Program Files\Microsoft Visual Studio\Common7\IDE"
It seems that the Engine makes a difference between RunTime (DLL must be placed in the Executable Directory) and DesignTime ...


这篇关于在设计时引用非托管DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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