Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

/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

  • See Add Method (Imports Object).

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

Show:
© 2015 Microsoft