Compile Page, Project Designer (Visual Basic)

Use the Compile page of the Project Designer to specify compilation instructions. You can also specify advanced compiler options and pre-build or post-build events on this page.

To access the Compile page, select a project node in Solution Explorer, and then, on the Project menu, click Properties. When the Project Designer appears, click the Compile tab.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the active settings that you use determine these elements. This topic was written assuming that General Development settings have been selected. To view or change your settings, click Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Configuration and Platform

The following settings enable you to select the configuration and platform to display or modify.

Note

With simplified build configurations, the project system determines whether to build a debug or release version. Therefore, these options are not displayed. To enable advanced build configurations, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, click General, and then select the Show advanced build configurations check box. This gives you manual control over all configuration values and whether a debug or release version is built. For more information, see General, Projects and Solutions, Options Dialog Box.

  • Configuration
    Specifies which configuration settings to display or modify. The available settings are Active (Debug) (this is the default), Debug, Release, and All Configurations.

  • Platform
    Specifies which platform settings to display or modify. The default setting is Active (Any CPU). You can change the active platform by using the Configuration Manager. For more information, see How to: Create and Edit Configurations.

Compiler Configuration Options

The following settings enable you to set the compiler configuration options.

  • Build output path
    Specifies the location of the output files for this project's configuration. Type the path of the build output in this box, or click the Browse button to select a path. Note that the path is relative; if you enter an absolute path, it will be saved as relative. The default path is bin\Debug.

    With simplified build configurations, the project system determines whether to build a debug or release version. The Build command from the Debug menu (F5) will put the build in the debug location regardless of the Output path you specify. However, the Build command from the Build menu puts it in the location you specify. To enable advanced build configurations, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, click General, and then clear the Show advanced build configurations check box. This gives you manual control over all configuration values and whether a debug or release version is built. For more information, see General, Projects and Solutions, Options Dialog Box.

  • Option explicit
    Specifies whether to allow implicit declaration of variables. By default, this is set to On, requiring explicit declaration of variables; this causes the compiler to report errors if variables are not declared before they are used. Select Off to allow implicit declaration of variables.

    This setting corresponds to the /optionexplicit compiler option.

  • Option strict
    Specifies whether to allow permissive type semantics. By default, this is set to Off, which allows permissive type semantics. Select On to restrict implicit type conversion; that is, explicit narrowing conversions will be required and late binding will not be allowed.

    The (custom) option will appear in this list if you enable the compiler notifications Implicit conversion, Late binding, or Implicit type (see the Warning configurations option below). Changing Option Strict back to On will restore those notifications to their defaults. For more information, see How to: Enable or Disable Compiler Warnings.

    This setting corresponds to the /optionstrict compiler option.

  • Option compare
    Specifies the type of string comparison to use. By default, this is set to Binary, which instructs the compiler to use binary, case-sensitive string comparisons. Select Text to use locale-specific, case-insensitive text string comparisons.

    This setting corresponds to the /optioncompare compiler option.

  • Option infer
    Specifies whether to allow local type inference in variable declarations. By default, this is set to On, which allows the use of local type inference. Select Off to block local type inference.

    This setting corresponds to the /optioninfer compiler option.

  • Warning configurations
    This table lists build conditions and the corresponding notification level of None, Warning, or Error for each.

    By default, all compiler warnings are added to the Task List during compilation. Select Disable all warnings to instruct the compiler not to issue warnings or errors. Select Treat all warnings as errors if you want the compiler to treat warnings as errors that must be fixed.

  • Disable all warnings
    Specifies whether to allow the compiler to issue notifications as specified in the Condition and Notification table described earlier in this document. By default, this check box is cleared. Select this check box to instruct the compiler not to issue warnings or errors.

    This setting corresponds to the /nowarn compiler option.

  • Treat all warnings as errors
    Specifies how to treat warnings. By default, this check box is cleared, so that all warning notifications remain set to Warning. Select this check box to change all warning notifications to Error.

    This option is available only if Disable all warnings is cleared.

  • Generate XML documentation file
    Specifies whether to generate documentation information. By default, this check box is selected, instructing the compiler to generate documentation information and include it in an XML file. Clear this check box to instruct the compiler not to create documentation.

    This setting corresponds to the /doc compiler option.

  • Register for COM interop
    Specifies whether your managed application will expose a COM object (a COM-callable wrapper) that enables a COM object to interact with the application.

    By default, this check box is cleared, which specifies that the application will not allow COM interop. Select this check box to allow COM interop.

    This option is not available for Windows Application or Console Application projects.

  • Build Events
    Click this button to access the Build Events dialog box. Use this dialog box to specify pre-build and post-build configuration instructions for the project. This dialog box applies to Visual Basic projects only. For more information, see Build Events Dialog Box (Visual Basic).

  • Advanced Compile Options
    Click this button to access the AdvancedCompiler Settings dialog box. Use the AdvancedCompiler Settings dialog box to specify a project's advanced build configuration properties. This dialog box applies to Visual Basic projects only. For more information, see Advanced Compiler Settings Dialog Box (Visual Basic).

See Also

Tasks

How to: Enable or Disable Compiler Warnings

How to: Set Compiler Optimizations

How to: Set Compiler Options

How to: Change the Build Location for an Application

How to: Generate XML Documentation for a Project

How to: Register a Component for COM Interop

How to: Set Compilation Constants

How to: Optimize an Application for a Specific CPU Type

How to: Specify a Base Address for a DLL

How to: Specify Build Events (Visual Basic)

Other Resources

Managing Compilation Properties

Visual Basic Compiler