When are referenced Assemblies loaded?

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-05-07T00:58:52Z Indexed on 2010/05/07 1:18 UTC
Read the original article Hit count: 197

Filed under:
|
|

I wrote a program that makes a reference to Microsoft.Web.Administration.dll, which is not present on Windows Server 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>

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?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about reference