/imports (Visual Basic)
Imports namespaces from a specified assembly.
/imports:namespaceList
Arguments
- namespaceList
Required. Comma-delimited list of namespaces to be imported.
Remarks
The /imports option imports any namespace defined within the current set of source files or from any referenced assembly.
The members in a namespace specified with /imports are available to all source-code files in the compilation. Use the Imports Statement (.NET Namespace and Type) to use a namespace in a single source-code file.
To set /imports in the Visual Studio integrated development environment
Have a project selected in Solution Explorer. On the Project menu, click Properties. For more information, see Introduction to the Project Designer.
Click the References tab.
Enter the namespace name in the box beside the Add User Import button.
Click the Add User Import button.
Example
The following code compiles when /imports:system is specified.
Module MyModule
Sub Main()
Console.WriteLine("test")
' Otherwise, would need
' System.Console.WriteLine("test")
End Sub
End Module
See Also
Concepts
References and the Imports Statement
Reference
Sample Compilation Command Lines