何时引用了Assemblies加载?

时间:2010-05-07 00:58:53

标签: .net dll reference

我编写了一个程序来引用Microsoft.Web.Administration.dll, 这在Windows Server 2003上不存在。

程序检查操作系统,如果操作系统是2003,则不引用dll。

if(OSVersion == WindowsServer2003)
    //do the job without referencing the Microsoft.Web.Administration.<br>
else if(OSVersion == WindowsServer2008)
   //reference the Microsoft.Web.Administration.dll file.<br>

当我在Windows Server 2003上测试此程序时,发生错误,告诉我它无法找到Microsoft.Web.Administration.dll。 但是当我将if-else块分成2个不同的方法时,如下所示,并且没有发生错误。

if(OSVersion == WindowsServer2003)
   //do the job without referencing the Microsoft.Web.Administration.<br>
else if(OSVersion == WindowsServer2008)
   //DoIt2008Style();

所以我想更详细地了解参考文件加载时间。 你能指点我一些资源吗?

1 个答案:

答案 0 :(得分:5)

当您输入引用另一个程序集中的类型的方法时。尝试延迟加载x86和x64程序集时,Here就是一个例子。

相关问题