/lib (Specify Assembly Reference Locations) (C# Compiler Options)
The /lib option specifies the location of assemblies referenced by means of theoption.
A directory for the compiler to look in if a referenced assembly is not found in the current working directory (the directory from which you are invoking the compiler) or in the common language runtime's system directory.
One or more additional directories to search in for assembly references. Separate additional directory names with a comma, and without white space between them.
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. Seefor 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. For details, see.
Click the References Path property page.
Modify the contents of the list box.
For information on how to set this compiler option programmatically, see.
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