添加dll而不在项目中添加其Reference [英] Add dll without adding Its Reference in the project

查看:42
本文介绍了添加dll而不在项目中添加其Reference的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正在使用dll说MyDll.dll。

我想在不使用添加引用的情况下以编程方式添加加载这个dll。

但它不允许我通过添加它的引用来实现dll中存在的接口。



有没有办法呢?

Hello,

I am using a dll say MyDll.dll.
I want add load this dll programtically without using adding its reference.
But its not letting me to implement the interface present in the dll with adding its reference.

Is there any way of doing it??

推荐答案

你可以用Assembly.Load [ ^ ]然后通过反射引用类 - 但这是相当多的工作,你不能以通常的方式直接在你的代码中使用类名。



如果你想比如说:

You can use Assembly.Load[^] and then reference the classes via reflection - but it's a fair amount of work and you can't use class names directly in your code in the usual way.

If you want to say things like:
MyAssembly.MyClass mc = new MyAssembly.MyClass();

然后你必须添加一个参考。

Then you have to add a reference.


请通过这个链接

http://stackoverflow.com/questions/11530281/adding-programmatically- in-c-sharp-a-project-reference-as-against-an-assembl [ ^ ]



可能有帮助
please go through this link
http://stackoverflow.com/questions/11530281/adding-programmatically-in-c-sharp-a-project-reference-as-opposed-to-an-assembl[^]

may be it helps


这篇关于添加dll而不在项目中添加其Reference的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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