当被引用的程序集装? [英] When are referenced Assemblies loaded?
问题描述
我写了一个程序,使引用Microsoft.Web.Administration.dll, 这是不是Windows Server 2003上present。
I wrote a program that makes a reference to Microsoft.Web.Administration.dll, which is not present on Windows Server 2003.
该程序检查操作系统和未引用的DLL如果操作系统是2003。
The program checks for the os and does not reference the dll if the os is 2003.
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块划分成两个不同的方法如下,并且没有发生错误。
When I tested this program on Windows Server 2003, an error occured telling me it couldn't locate the Microsoft.Web.Administration.dll.
But when I separated the if-else block into 2 different methods as below, and the error did not occur.
if(OSVersion == WindowsServer2003)
//do the job without referencing the Microsoft.Web.Administration.<br>
else if(OSVersion == WindowsServer2008)
//DoIt2008Style();
所以,我想了解更详细的参考文件加载时间。 你能点我的一些资源?
So I wanted to know about reference file loading time in more detail. could you point me to some resources?
推荐答案
当你输入引用另一个组件的类型的方法。 这里试图延迟加载86时是一个例子, 64集。
When you enter a method that references a type in another assembly. Here is an example when trying to delay load x86 and x64 assemblies.
这篇关于当被引用的程序集装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!