|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/reference (Visual Basic)
Causes the compiler to make type information in the specified assemblies available to the project you are currently compiling.
The file(s) you import must contain assembly metadata. Only public types are visible outside the assembly. Theoption imports metadata from a module.
If you reference an assembly (Assembly A) which itself references another assembly (Assembly B), you need to reference Assembly B if:
A type from Assembly A inherits from a type or implements an interface from Assembly B.
A field, property, event, or method that has a return type or parameter type from Assembly B is invoked.
Useto specify the directory in which one or more of your assembly references is located.
For the compiler to recognize a type in an assembly (not a module), it must be forced to resolve the type. One example of how you can do this is to define an instance of the type. Other ways are available to resolve type names in an assembly for the compiler. For example, if you inherit from a type in an assembly, the type name then becomes known to the compiler.
The Vbc.rsp response file, which references commonly used .NET Framework assemblies, is used by default. Use /noconfig if you do not want the compiler to use Vbc.rsp.
The short form of /reference is /r.
To set /reference in the Visual Studio integrated development environment
The following code compiles source file Input.vb and reference assemblies from Metad1.dll and Metad2.dll to produce Out.exe.
vbc /reference:metad1.dll,metad2.dll /out:out.exe input.vb