在运行时添加应用程序的引用 [英] add reference of application at runtime

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

问题描述

如何通过代码在Windows应用程序中添加应用程序的引用。

例如我有两个autocade引用,如briscade和autocad 9所以我必须处理案例,如果客户端已经安装了briscad然后它在参考的基础上工作,如果客户端有autocad 9然后它相应地工作,简而言之,我已经为autocad应用程序准备了代码。请指导我。

How to add reference of application in windows application through code.
for example i have two autocade reference like briscade and autocad 9 so i have to handle case for that if client have installed briscad then it works on reference basis,and if client have autocad 9 then it work accordingly,in short i have prepare code general for both autocad application.so please guide me.

推荐答案

你需要使用反思 [ ^ ]。



有关详细信息:

在运行时动态加载类 [ ^ ]

<小时ef =http://www.codeproject.com/Articles/32828/Using-Reflection-to-load-unreferenced-assemblies-a>使用Reflection在运行时在C#中加载未引用的程序集 [ ^ ]

使用接口和反射动态加载.NET程序集 [ ^ ]

C#反射和动态方法调用 [ ^ ]
You'll need to use Reflection[^] for that.

For more info:
Dynamically Loading Classes at Runtime[^]
Using Reflection to load unreferenced assemblies at runtime in C#[^]
Dynamically Loading .NET Assemblies using Interfaces and Reflection[^]
C# Reflection and Dynamic Method Invocation[^]


隐藏某些界面后面的实际CAD对象。您的应用程序必须拥有一个工厂来创建适当的对象。工厂被告知要使用哪一个(例如通过配置或控制容器的反转)或者可以以某种方式自行找出(例如在注册表中搜索已安装的CAD应用程序)。
Hide the actual CAD objects behind some interface(s). Your application has to hold a factory for creating the appropriate objects. The factory is told which one to use (e.g. by configuration, or an Inversion of Control container) or can somehow find out by itself (e.g. searching the registry for the installed CAD application).


这篇关于在运行时添加应用程序的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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