在C#中以编程方式添加引用 [英] Adding a reference programmatically in C#

查看:149
本文介绍了在C#中以编程方式添加引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果我最近一直在问很多问题,

这次我想知道如何在C#中以编程方式添加引用,

我是使用CS代码提供程序创建自定义C#编译器(有经验的用户会知道这一点)和Code-Dom,我希望用户能够添加引用并在我的自定义编译器中使用它们。

引用意味着DLLS可以使用Visual Studio的GUI添加,右键单击references文件夹并选择Add References,这是通过GUI完成的,但我希望以编程方式完成同样的事情。

任何建议???

Sorry, if I have been asking a lot of questions lately,
This time I want to know "How can I add reference programmatically in C#,
I am creating a Custom C# compiler using CS Code Provider (experienced users would know this) & Code-Dom, I want the user to be able to add references and use them in my custom compiler.
References mean the "DLLS" that can be added using the GUI of Visual Studio, by right-clicking the references folder and selecting "Add References", This is done through the GUI, but I want the same thing to be done Programmatically.
Any Suggestions???

推荐答案

你想在C#中使用Reflection。你可以使用一个Assembly类。一个很好的例子是 http:// social.msdn.microsoft.com/Forums/vstudio/en-US/054f9b1e-dcbf-410d-9e92-b4fc65a85ded/dynamic-dll -reference-in-c [ ^ ]。
You'll want to use Reflection in C#. There is an Assembly class you can use. A good example is at http://social.msdn.microsoft.com/Forums/vstudio/en-US/054f9b1e-dcbf-410d-9e92-b4fc65a85ded/dynamic-dll-reference-in-c[^].


这篇关于在C#中以编程方式添加引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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