Visual Studio 2010 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 settings that you use determine these elements. 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, the Configuration and Platform lists are not displayed. For more information, see Debug and Release Project Configurations. |
- Configuration
Specifies which configuration settings to display or modify. The settings are Debug (default), Release, or All Configurations. For more information, see Debug and Release Project Configurations and How to: Create and Edit Configurations. - Platform
Specifies which platform settings to display or modify. The choices can include x86 (default), x64, Itanium, and Any CPU. For more information, see Debug and Release Project 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\ or bin\Release\. For more information, see Debug and Release Project Configurations. 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. For more information, see Debug and Release Project Configurations. - Option explicit
Specifies whether to allow implicit declaration of variables. Select On to require 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. If a source code file contains an Option Explicit Statement (Visual Basic), the On or Off value in the statement overrides the Option Explicit setting on the Compile page. When you create a new project, the Option Explicit setting on the Compile page is set to the value of the Option Explicit setting in the Options dialog box. To view or change the setting in this dialog box, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, and then click VB Defaults. The initial default setting of Option Explicit in VB Defaults is On. Setting Option Explicit to Off is generally not a good practice. You could misspell a variable name in one or more locations, which would cause unexpected results when the program is run. - Option strict
Specifies whether to enforce strict type semantics. When Option Strict is On, the following conditions cause a compile-time error: Implicit narrowing conversion errors occur when there is an implicit data type conversion that is a narrowing conversion. For more information, see Option Strict Statement, Implicit and Explicit Conversions, and Widening and Narrowing Conversions. An object is late bound when it is assigned to a property or method of a variable that is declared to be of type Object. For more information, see Option Strict Statement and Early and Late Binding. Implicit object type errors occur when an appropriate type cannot be inferred for a declared variable, so a type of Object is inferred. This primarily occurs when you use a Dim statement to declare a variable without using an As clause, and Option Infer is off. For more information, see Option Strict Statement, Option Infer Statement, and the Visual Basic Language Specification. The Option Strict setting corresponds to the /optionstrict compiler option. If a source code file contains an Option Strict Statement, the On or Off value in the statement overrides the Option Strict setting on the Compile page. When you create a project, the Option Strict setting on the Compile page is set to the value of the Option Strict setting in the Options dialog box. To view or change the setting in this dialog box, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, and then click VB Defaults. The initial default setting of Option Strict in VB Defaults is Off. Option Strict Individual Warnings. The Warning configurations section of the Compile page has settings that correspond to the three conditions that cause a compile-time error when Option Strict is on. Following are these settings: When you set Option Strict to On, all three of these warning configuration settings are set to Error. When you set Option Strict to Off, all three settings are set to None. You can individually change each warning configuration setting to None, Warning, or Error. If all three warning configuration settings are set to Error, On appears in the Option strict box. If all three are set to None, Off appears in this box. For any other combination of these settings, (custom) appears. - Option compare
Specifies the type of string comparison to use. Select Binary to instruct 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. If a source code file contains an Option Compare Statement, the Binary or Text value in the statement overrides the Option Compare setting on the Compile page. When you create a project, the Option Compare setting on the Compile page is set to the value of the Option Compare setting in the Options dialog box. To view or change the setting in this dialog box, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, and then click VB Defaults. The initial default setting of Option Compare in VB Defaults is Binary. - Option infer
Specifies whether to allow local type inference in variable declarations. Select On to allow the use of local type inference. Select Off to block local type inference. This setting corresponds to the /optioninfer compiler option. If a source code file contains an Option Infer Statement, the On or Off value in the statement overrides the Option Infer setting on the Compile page. When you create a project, the Option Infer setting on the Compile page is set to the value of the Option Infer setting in the Options dialog box. To view or change the setting in this dialog box, on the Tools menu, click Options. In the Options dialog box, expand Projects and Solutions, and then click VB Defaults. The initial default setting of Option Infer in VB Defaults is On. - 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 Advanced Compiler Settings dialog box. Use the Advanced Compiler 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
TasksReferenceOther Resources

Change History
Date | History | Reason |
April 2011
| Added information about the Option explicit, Option strict, Option compare, and Option infer settings. |
Information enhancement.
|
|
Visual Studio 2010 Seite "Kompilieren", Projekt-Designer (Visual Basic) Auf der Seite Kompilieren im Projekt-Designer können Sie Kompilierungsanweisungen angeben. Außerdem können Sie auf dieser Seite erweiterte Compileroptionen und Präbuild- oder Postbuildereignisse angeben. Wählen Sie zum Aufrufen der Seite Kompilieren einen Projektknoten im Projektmappen-Explorer aus, und klicken Sie anschließend im Menü Projekt auf Eigenschaften. Wenn der Projekt-Designer angezeigt wird, klicken Sie auf die Registerkarte Kompilieren.
Hinweis |
|---|
|
Ihr Computer zeigt möglicherweise für einige der Elemente der Visual Studio-Benutzeroberfläche in der folgenden Anleitung andere Namen oder Standorte an. Diese Elemente sind von der jeweiligen Visual Studio-Version und den verwendeten Einstellungen abhängig. Weitere Informationen finden Sie unter Visual Studio-Einstellungen.
|

Konfiguration und Plattform
Mit den folgenden Einstellungen können Sie die anzuzeigende bzw. zu ändernde Konfiguration und Plattform auswählen. Hinweis |
|---|
Mit vereinfachten Buildkonfigurationen bestimmt das Projektsystem, ob eine Debug- oder eine Releaseversion erstellt werden soll. Daher werden die Listen Konfiguration und Plattform nicht angezeigt. Weitere Informationen finden Sie unter Debug- und Releaseprojektkonfigurationen. |
- Konfiguration
Gibt an, welche Konfigurationseinstellungen angezeigt oder geändert werden sollen. Die Einstellungen sind Debug (Standard), Release oder Alle Konfigurationen. Weitere Informationen finden Sie unter Debug- und Releaseprojektkonfigurationen und Gewusst wie: Erstellen und Bearbeiten von Konfigurationen. - Plattform
Gibt an, welche Plattformeinstellungen angezeigt oder geändert werden sollen. Die Auswahlmöglichkeiten können x86 (Standard), x64, Itanium, und Beliebige CPU beinhalten. Weitere Informationen finden Sie unter Debug- und Releaseprojektkonfigurationen.

Compilerkonfigurationsoptionen
Mit den folgenden Optionen können Sie die Compilerkonfigurationsoptionen festlegen. - Ausgabepfad erstellen
Legt den Speicherort für die Ausgabedateien für die Konfiguration dieses Projekts fest. Geben Sie den Pfad der Buildausgabe in dieses Feld ein, oder klicken Sie auf die Schaltfläche Durchsuchen, um einen Pfad auszuwählen. Beachten Sie, dass der Pfad relativ ist. Bei der Eingabe eines absoluten Pfads wird dieser als relativer Pfad gespeichert. Der Standardpfad lautet bin\Debug\ oder bin\Release\. Weitere Informationen finden Sie unter Debug- und Releaseprojektkonfigurationen. Mit vereinfachten Buildkonfigurationen bestimmt das Projektsystem, ob eine Debug- oder eine Releaseversion erstellt werden soll. Mit dem Befehl Erstellen im Menü Debuggen (F5) wird der Build unabhängig vom angegebenen Ausgabepfad am Debugspeicherort abgelegt. Mit dem Befehl Erstellen im Menü Erstellen hingegen wird er an dem Speicherort abgelegt, den Sie angeben. Weitere Informationen finden Sie unter Debug- und Releaseprojektkonfigurationen. - Option Explicit
Gibt an, ob eine implizite Deklaration von Variablen zulässig ist. Wählen Sie An aus, damit explizite Variablendeklarationen erforderlich sind. Bewirkt, dass der Compiler Fehler meldet, wenn Variablen vor der Verwendung nicht deklariert wurden. Wenn Sie eine implizite Deklaration der Variablen wünschen, wählen Sie Off aus. Diese Einstellung entspricht der /optionexplicit-Compileroption. Wenn ein Quellcodedatei eine Option Explicit-Anweisung (Visual Basic) enthält, überschreibt der Wert On oder Off in der Anweisung die Einstellung Option Explicit auf der Seite Kompilieren. Wenn Sie ein neues Projekt erstellen, wird die Einstellung Option Explicit auf der Seite Kompilieren auf den Wert der Einstellung Option Explicit im Dialogfeld Optionen festgelegt. Um die Einstellung in diesem Dialogfeld anzuzeigen oder zu ändern, klicken Sie im Menü Extras auf Optionen. Erweitern Sie im Dialogfeld Optionen die Option Projekte und Projektmappen, und klicken Sie dann auf VB-Standard. Die anfängliche Standardeinstellung Option Explicit in VB-Standard ist On. Das Festlegen von Option Explicit auf Off wird im Allgemeinen nicht empfohlen. Sie könnten einen Variablennamen an einer oder mehreren Stellen falsch schreiben, was zu unerwarteten Ergebnissen führen würde, wenn das Programm ausgeführt wird. - Option Strict
Gibt an, ob eine strikte Typsemantik erzwungen wird. Wenn Option Strict On ist, verursachen die folgenden Bedingungen einen Kompilierungsfehler: Implizite Einschränkungskonvertierungsfehler treten auf, wenn eine implizite Datentypkonvertierung vorliegt, die eine einschränkende Konvertierung ist. Weitere Informationen finden Sie unter Option Strict-Anweisung, Implizite und explizite Konvertierungen (Visual Basic) und Erweiternde und eingrenzende Konvertierungen (Visual Basic). Ein Objekt wird spät gebunden, wenn es einer Eigenschaft oder Methode einer Variablen zugeordnet wird, für die der Typ Object deklariert wurde. Weitere Informationen finden Sie unter Option Strict-Anweisung und Frühes und spätes Binden (Visual Basic). Implizite Objekttypfehler treten auf, wenn ein geeigneter Typ nicht für eine deklarierte Variable abgeleitet werden kann, sodass ein Typ von Object abgeleitet wird. Dies geschieht hauptsächlich, wenn Sie eine Dim-Anweisung verwenden, um eine Variable zu deklarieren, ohne eine As-Klausel zu verwenden, und wenn Option Infer deaktiviert ist. Weitere Informationen finden Sie unter Option Strict-Anweisung, Option Infer-Anweisung und Visual Basic-Sprachspezifikation. Diese Einstellung Option Strict entspricht der /optionstrict-Compileroption. Wenn ein Quellcodedatei eine Option Strict-Anweisung enthält, überschreibt der Wert On oder Off in der Anweisung die Einstellung Option Strict auf der Seite Kompilieren. Wenn Sie ein Projekt erstellen, wird die Einstellung Option Strict auf der Seite Kompilieren auf den Wert der Einstellung Option Strict im Dialogfeld Optionen festgelegt. Um die Einstellung in diesem Dialogfeld anzuzeigen oder zu ändern, klicken Sie im Menü Extras auf Optionen. Erweitern Sie im Dialogfeld Optionen die Option Projekte und Projektmappen, und klicken Sie dann auf VB-Standard. Die anfängliche Standardeinstellung Option Strict in VB-Standard ist Off. Option Strenge individuelle Warnungen. Der Abschnitt Warnungskonfigurationen auf der Seite Kompilieren verfügt über Einstellungen, die mit den drei Bedingungen übereinstimmen, die einen Kompilierungsfehler verursachen, wenn Option Strict aktiviert ist. Nachfolgend diese Einstellungen: Wenn Sie Option Strict auf On festlegen, werden alle drei Warnungskonfigurationseinstellungen auf Fehler festgelegt. Wenn Sie Option Strict auf Off festlegen, werden alle drei Einstellungen auf Keine festgelegt. Sie können jede Warnungskonfigurationseinstellung einzeln in Keine, Warnung oder Fehler ändern. Wenn alle drei Warnungskonfigurationseinstellungen auf Fehler festgelegt sind, wird On im Option strict-Feld angezeigt. Wenn alle drei auf Keine festgelegt sind, wird Off in diesem Feld angezeigt. Für jede andere Kombination dieser Einstellungen wird (benutzerdefiniert) angezeigt. - Option Compare
Gibt den zu verwendenden Typ des Zeichenfolgenvergleichs an. Wählen Sie Binär aus, um den Compiler anzuweisen, binäre Zeichenfolgenvergleiche zu verwenden, bei denen die Groß-/Kleinschreibung beachtet wird. Wählen Sie Text aus, um gebietsschemaspezifische Textzeichenfolgenvergleiche zu verwenden, bei denen die Groß-/Kleinschreibung nicht berücksichtigt wird. Diese Einstellung entspricht der /optioncompare-Compileroption. Wenn ein Quellcodedatei eine Option Compare-Anweisung enthält, überschreibt der Wert Binary oder Text in der Anweisung die Einstellung Option Compare auf der Seite Kompilieren. Wenn Sie ein Projekt erstellen, wird die Einstellung Option Compare auf der Seite Kompilieren auf den Wert der Einstellung Option Compare im Dialogfeld Optionen festgelegt. Um die Einstellung in diesem Dialogfeld anzuzeigen oder zu ändern, klicken Sie im Menü Extras auf Optionen. Erweitern Sie im Dialogfeld Optionen die Option Projekte und Projektmappen, und klicken Sie dann auf VB-Standard. Die anfängliche Standardeinstellung Option Compare in VB-Standard ist Binär. - Option Infer
Gibt an, ob lokaler Typrückschluss in Variablendeklarationen zulässig ist. Wählen Sie An aus, um die Verwendung von lokalem Typrückschluss zu ermöglichen. Wählen Sie Off, um den lokalen Datentyprückschluss zu blockieren. Diese Einstellung entspricht der /optioninfer-Compileroption. Wenn ein Quellcodedatei eine Option Infer-Anweisung enthält, überschreibt der Wert On oder Off in der Anweisung die Einstellung Option Infer auf der Seite Kompilieren. Wenn Sie ein Projekt erstellen, wird die Einstellung Option Infer auf der Seite Kompilieren auf den Wert der Einstellung Option Infer im Dialogfeld Optionen festgelegt. Um die Einstellung in diesem Dialogfeld anzuzeigen oder zu ändern, klicken Sie im Menü Extras auf Optionen. Erweitern Sie im Dialogfeld Optionen die Option Projekte und Projektmappen, und klicken Sie dann auf VB-Standard. Die anfängliche Standardeinstellung Option Infer in VB-Standard ist On. - Warnungskonfigurationen
Diese Tabelle enthält eine Liste der Buildbedingungen und die entsprechenden Benachrichtigungsebenen Keine, Warnung oder Fehler. Alle Compilerwarnungen werden während der Kompilierung standardmäßig in die Aufgabenliste aufgenommen. Wählen Sie Alle Warnungen deaktivieren aus, wenn der Compiler keine Warnungen oder Fehler ausgeben soll. Wählen Sie +++Alle Warnungen als Fehler behandeln, wenn der Compiler Warnungen als zu behebende Fehler behandeln soll. - Alle Warnungen deaktivieren
Gibt an, ob der Compiler Benachrichtigungen ausgeben darf, wie in der weiter vorne in diesem Dokument beschriebenen Tabelle über Bedingungen und Benachrichtigungen angegeben. Dieses Kontrollkästchen ist standardmäßig aktiviert. Aktivieren Sie dieses Kontrollkästchen, um den Compiler anzuweisen, keine Warnungen oder Fehler auszugeben. Diese Einstellung entspricht der /nowarn-Compileroption. - Alle Warnungen als Fehler behandeln
Gibt an, wie Warnungen zu behandeln sind. Dieses Kontrollkästchen ist standardmäßig deaktiviert, damit alle Warnbenachrichtigungen auf Warnung festgelegt bleiben. Aktivieren Sie dieses Kontrollkästchen, um alle Warnbenachrichtigungen in Fehler zu ändern. Diese Option ist nur verfügbar, wenn Alle Warnungen deaktivieren deaktiviert ist. - XML-Dokumentationsdatei generieren
Gibt an, ob Dokumentationsinformationen generiert werden sollen. Dieses Kontrollkästchen ist standardmäßig aktiviert. Dadurch wird der Compiler angewiesen, Dokumentationsinformationen zu generieren und in eine XML-Datei aufzunehmen. Deaktivieren Sie dieses Kontrollkästchen, um den Compiler anzuweisen, keine Dokumentation zu erstellen. Diese Einstellung entspricht der /doc-Compileroption. - Für COM-Interop registrieren
Gibt an, ob die verwaltete Anwendung ein COM-Objekt (einen COM Callable Wrapper) verfügbar macht, das einem COM-Objekt die Interaktion mit der Anwendung ermöglicht. Dieses Kontrollkästchen ist standardmäßig deaktiviert und gibt an, dass die Anwendung COM-Interop nicht zulässt. Aktivieren Sie dieses Kontrollkästchen, um COM-Interop zuzulassen. Diese Option ist für Windows-Anwendungsprojekte oder Konsolenanwendungsprojekte nicht verfügbar. - Buildereignisse
Klicken Sie auf diese Schaltfläche, um auf das Dialogfeld Buildereignisse zuzugreifen. Geben Sie über dieses Dialogfeld Anweisungen für Präbuild- und Postbuildkonfigurationen für das Projekt an. Dieses Dialogfeld gilt nur für Visual Basic-Projekte. Weitere Informationen finden Sie unter Dialogfeld "Buildereignisse" (Visual Basic). - Erweiterte Kompilierungsoptionen
Klicken Sie auf diese Schaltfläche, um auf das Dialogfeld Erweiterte Compilereinstellungen zuzugreifen. Geben Sie im Dialogfeld Erweiterte Compilereinstellungen die Eigenschaften der erweiterten Buildkonfiguration eines Projekts an. Dieses Dialogfeld gilt nur für Visual Basic-Projekte. Weitere Informationen finden Sie unter Dialogfeld "Erweiterte Compilereinstellungen (Visual Basic).

Siehe auch
AufgabenReferenzWeitere Ressourcen

Änderungsprotokoll
Datum | Versionsgeschichte | Grund |
April 2011
| Informationen zu den Einstellungen Option explicit, Option strict, Option compare und Option infer wurden hinzugefügt. |
Informationsergänzung.
|
|