/lib (C# Compiler Options)
The /lib option specifies the location of assemblies referenced by means of the /reference (C# Compiler Options) option.
The compiler searches for assembly references that are not fully qualified in the following order:
Current working directory. This is the directory from which the compiler is invoked.
The common language runtime system directory.
Directories specified by /lib.
Directories specified by the LIB environment variable.
Use /reference to specify an assembly reference.
/lib is additive; specifying it more than once appends to any prior values.
An alternative to using /lib is to copy into the working directory any required assemblies; this will allow you to simply pass the assembly name to /reference. You can then delete the assemblies from the working directory. Since the path to the dependent assembly is not specified in the assembly manifest, the application can be started on the target computer and will find and use the assembly in the global assembly cache.
Because the compiler can reference the assembly does not imply the common language runtime will be able to find and load the assembly at runtime. See How the Runtime Locates Assemblies for details on how the runtime searches for referenced assemblies.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box.
Click the References Path property page.
Modify the contents of the list box.
For information on how to set this compiler option programmatically, see ReferencePath.
Compile t2.cs to create an .exe file. The compiler will look in the working directory and in the root directory of the C drive for assembly references.
csc /lib:c:\ /reference:t2.dll t2.cs