从命令行生成 (Visual Basic)Building from the Command Line (Visual Basic)

Visual Basic 项目由一个或多个单独的源文件组成。A Visual Basic project is made up of one or more separate source files. 在名为编译的过程中,这些文件会一起合并到一个包中,这是可作为应用程序运行的单个可执行文件。During the process known as compilation, these files are brought together into one package—a single executable file that can be run as an application.

Visual Basic 提供命令行编译器作为替代方法,用于在 Visual Studio 集成开发环境 (IDE) 中编译程序。Visual Basic provides a command-line compiler as an alternative to compiling programs from within the Visual Studio integrated development environment (IDE). 命令行编译器旨在用于不需要 IDE 中的完整功能集的情况(例如,为系统内存或存储空间有限的计算机进行使用或编写)。The command-line compiler is designed for situations in which you do not require the full set of features in the IDE—for example, when you are using or writing for computers with limited system memory or storage space.

若要从 Visual Studio IDE 中编译源文件,请从“生成” 菜单中选择“生成” 命令。To compile source files from within the Visual Studio IDE, choose the Build command from the Build menu.

提示

使用 Visual Studio IDE 生成项目文件时,可以在输出窗口中显示有关关联 vbc 命令及其开关的信息。When you build project files by using the Visual Studio IDE, you can display information about the associated vbc command and its switches in the output window. 若要显示此信息,请打开“选项”对话框、“项目和解决方案”、“生成和运行”,然后将“MSBuild 项目生成输出详细信息” 设置为“普通” 或更高级别的详细程度。To display this information, open the Options Dialog Box, Projects and Solutions, Build and Run, and then set the MSBuild project build output verbosity to Normal or a higher level of verbosity. 有关详细信息,请参阅如何:查看、保存和配置生成日志文件For more information, see How to: View, Save, and Configure Build Log Files.

可以使用 MSBuild 在命令提示符下编译项目 (.vbproj) 文件。You can compile project (.vbproj) files at a command prompt by using MSBuild. 有关详细信息,请参阅命令行参考演练:使用 MSBuildFor more information, see Command-Line Reference and Walkthrough: Using MSBuild.

本节内容In This Section

如何:调用命令行编译器 How to: Invoke the Command-Line Compiler
介绍如何在 MS-DOS 提示符下或从特定子目录调用命令行编译器。Describes how to invoke the command-line compiler at the MS-DOS prompt or from a specific subdirectory.

示例编译命令行 Sample Compilation Command Lines
提供可以进行修改以供自己使用的示例命令行的列表。Provides a list of sample command lines that you can modify for your own use.

Visual Basic 命令行编译器 Visual Basic Command-Line Compiler
提供按字母顺序或用途组织的编译器选项的列表。Provides lists of compiler options, organized alphabetically or by purpose.

条件编译 Conditional Compilation
介绍如何编译代码的特定部分。Describes how to compile particular sections of code.

在 Visual Studio 中生成和清理项目和解决方案 Building and Cleaning Projects and Solutions in Visual Studio
介绍如何组织将包含在不同生成中的内容、选择项目属性以及确保项目按正确顺序生成。Describes how to organize what will be included in different builds, choose project properties, and ensure that projects build in the correct order.