引用,在运行时加载程序集的不同副本

时间:2013-05-23 04:48:36

标签: .net reference runtime

如何在项目目录中引用托管程序集以构建我的应用程序,然后让CLR在运行时加载该程序集的不同副本(在指定路径上)?

1 个答案:

答案 0 :(得分:0)

您可以显式加载程序集,但在自动加载之前执行,例如

static class Program {
  static void Main() {
    ...
    // Loading assembly before it's implicitly loaded    
    String path = @"C:\Program Files\MyDlls\MyAssembly.dll"
    Assembly.LoadForm(path); 
    ...
    // First use of the loaded assembly 
    MyType v = new MyType();