-imports (Visual Basic)

Imports namespaces from a specified assembly.




Term Definition
namespaceList Required. Comma-delimited list of namespaces to be imported.


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
1. Have a project selected in Solution Explorer. On the Project menu, click Properties.
2. Click the References tab.
3. Enter the namespace name in the box beside the Add User Import button.
4. Click the Add User Import button.


The following code compiles when /imports:system.globalization is specified. Without it, successful compilation requires either that an Imports System.Globalization statement be included at the beginning of the source code file, or that the property be fully qualified as System.Globalization.CultureInfo.CurrentCulture.Name.

Module Example
   Public Sub Main()
      Console.WriteLine($"The current culture is {CultureInfo.CurrentCulture.Name}")
   End Sub
End Module

See also