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.

dir2

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. 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.