Visual Basic Compiler Options  

/imports

Imports a namespace from a specified assembly.

/imports:namespace[, namespace]

Arguments

namespace
Required. The namespace 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 to use a namespace in a single source code file.

To set /imports in the Visual Studio integrated development environment

  1. Open the project's Property Pages dialog box. For details, see <Projectname> Property Pages Dialog Box.
  2. Click the Common Properties folder.
  3. Click the Imports property page.
  4. Modify the Namespace property.

To set /import programmatically

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

Visual Basic Compiler Options | References and the Imports Statement | Sample Compilation Command Lines