“常规”属性页(项目)General Property Page (Project)

本主题适用于适用于 Windows 的 Visual Studio 项目。This topic applies to Visual Studio projects for Windows. 对于 Linux 项目,请参阅 Linux c + + 属性页引用For Linux projects, see Linux C++ Property Page Reference. 对于 CMake 项目,请参阅 Visual Studio 中的 CMake 项目For CMake projects, see CMake projects in Visual Studio. 对于 Android 项目,请参阅 常规项目属性 (Android c + +) For Android projects, see General Project Properties (Android C++). 对于 Android 生成文件项目,请参阅 常规项目属性 (Android c + + makefile) For Android Makefile projects, see General Project Properties (Android C++ Makefile)

右键单击 "解决方案资源管理器中的项目节点,然后选择"属性"时,左窗格中"配置属性"节点下的"常规 属性 "页将显示以下属性:When you right-click on a project node in Solution Explorer, and select Properties, the General property page under the Configuration Properties node in the left pane displays these properties:

  • 输出目录Output Directory

    指定链接器等工具将放置在生成过程中创建的所有最终输出文件的目录。Specifies the directory where tools such as the linker will place all final output files that are created during the build process. 通常,这包括链接器、库管理器或 BSCMake 等工具的输出。Typically, this includes the output of tools such as the linker, librarian, or BSCMake. 此属性在默认情况下是由宏 $(SolutionDir)$(Configuration)\ 指定的目录。By default, this property is the directory specified by the macros $(SolutionDir)$(Configuration).

    若要以编程方式访问此属性,请参阅 OutputDirectoryTo programmatically access this property, see OutputDirectory.

  • 中间目录Intermediate Directory

    指定编译器等工具将放置在生成过程中创建的所有中间文件的目录。Specifies the directory where tools such as the compiler will place all intermediate files created during the build process. 通常,这包括 C/C++ 编译器、MIDL 和资源编译器等工具的输出。Typically, this includes the output of tools such as the C/C++ compiler, MIDL, and the resource compiler. 此属性在默认情况下是由宏 $(Configuration)\ 指定的目录。By default, this property is the directory specified by the macro $(Configuration).

    若要以编程方式访问此属性,请参阅 IntermediateDirectoryTo programmatically access this property, see IntermediateDirectory.

  • 目标名称Target Name

    指定此项目生成的文件名称。Specifies the file name this project generates. 此属性在默认情况下是由宏 $(ProjectName) 指定的文件名。By default, this property is the filename specified by the macro $(ProjectName).

  • 配置类型Configuration Type

    有几种配置类型可供选择:There are several configuration types from which to choose:

    • 应用程序(.exe)Application (.exe)

      显示链接器工具集(C/C++ 编译器、MIDL、资源编译器、链接器、BSCMake、XML Web 服务代理生成器、自定义生成、预生成、链接前、生成后事件)。Displays linker toolset (C/C++ Compiler, MIDL, Resource Compiler, Linker, BSCMake, XML Web Service Proxy Generator, custom build, prebuild, prelink, postbuild events).

    • 动态库(.dll)Dynamic Library (.dll)

      显示链接器工具集,指定 /DLL 链接器选项并将 _WINDLL 定义添加到 CL。Displays linker toolset, specifies /DLL linker option, and adds the _WINDLL define to CL.

    • 生成文件Makefile

      显示生成文件工具集 (NMake)。Displays makefile toolset (NMake).

    • 静态库(.lib)Static Library (.lib)

      显示库管理员工具集(除了链接器的替代库管理器外,其他与链接器工具集相同并且省略了 XML Web 服务代理生成器)。Displays librarian toolset (same as linker toolset except substitute librarian for linker and omit XML Web Service Proxy Generator).

    • 实用程序Utility

      显示实用工具集(MIDL、自定义生成、预生成、生成后事件)。Displays utility toolset (MIDL, custom build, prebuild, postbuild events).

    若要以编程方式访问此属性,请参阅 ConfigurationTypeTo programmatically access this property, see ConfigurationType.

  • Windows SDK 版本Windows SDK Version

    对于 Windows 目标平台,此字段指定项目所需的 Windows SDK 的版本。For the Windows target platform, this specifies the version of the Windows SDK that your project requires. 使用 Visual Studio 安装程序安装 C++ 工作负载时,也会安装所需的 Windows SDK 部件。When you install a C++ Workload by using the Visual Studio installer, the required parts of the Windows SDK are also installed. 如果计算机上有其他 Windows SDK 版本,已安装的每个版本的 SDK 工具都会出现在下拉列表中。If you have other Windows SDK versions on your computer, each version of the SDK tools that you have installed appears in the dropdown.

    若要面向 Windows 7 或 Windows Vista,请使用值 8.1,因为 Windows SDK 8.1 对于那些平台是后向兼容的。To target Windows 7 or Windows Vista, use the value 8.1, since Windows SDK 8.1 is backward compatible to those platforms. 此外,应在 targetver.h 中为 _WIN32_WINNT 定义适当的值。In addition, you should define the appropriate value for _WIN32_WINNT in targetver.h. 对于 Windows 7,即 0x0601。For Windows 7, that's 0x0601. 请参阅修改 WINVER 和 _WIN32_WINNTSee Modifying WINVER and _WIN32_WINNT.

    可以安装 Visual Studio 中内含的 Windows XP 平台工具集,以便使用当前版本的库来生成 Windows XP 和 Windows 2003 Server 项目。You can install the Windows XP platform toolset included in Visual Studio to use the current version of the libraries to build Windows XP and Windows 2003 Server projects. 有关如何获取和使用此平台工具集的信息,请参阅配置适用于 Windows XP 的程序For information on how to obtain and use this platform toolset, see Configuring Programs for Windows XP. 有关更改平台工具集的其他信息,请参阅如何:修改目标框架和平台工具集For additional information on changing the platform toolset, see How to: Modify the Target Framework and Platform Toolset.

  • 平台工具集Platform Toolset

    允许项目面向不同版本的 Visual C++ 库和编译器。Allows the project to target a different version of the Visual C++ libraries and compiler. Visual Studio c + + 项目可以面向 Visual Studio 安装的默认工具集,也可以是由多个以前版本的 Visual Studio 安装的工具集之一,其中包括用于创建可在 Windows XP 上运行的可执行文件的工具集。Visual Studio C++ projects can target either the default toolset installed by Visual Studio, or one of the toolsets installed by several previous versions of Visual Studio, including toolsets that create executables that can run on Windows XP. 有关更改平台工具集的信息,请参阅如何:修改目标框架和平台工具集For information on changing the platform toolset, see How to: Modify the Target Framework and Platform Toolset.

  • C++ 语言标准C++ Language Standard

    指定要使用的语言标准。Specifies which language standard to use. 默认值为/std: c + + 14。The default is /std:c++14. 指定/std: c + + 17,使用 c + + 17 功能,或使用/std: c + + + 最新版本来使用 c + + 20 或其他实验功能。Specify /std:c++17 to use C++17 features, or /std:c+++latest to use C++20 or other experimental features. 有关详细信息,请参阅 /std (指定语言标准版本) For more information, see /std (Specify Language Standard Version)

在 Visual Studio 2015 和 Visual Studio 2017 中,当你在 解决方案资源管理器 中右键单击项目节点并选择 "属性" 时,左窗格中 "配置属性" 节点下的 "常规 属性" 页将显示属性的两个部分:In Visual Studio 2015 and Visual Studio 2017, when you right-click on a project node in Solution Explorer, and select Properties, the General property page under the Configuration Properties node in the left pane displays two sections of properties:

  • 常规General

  • 项目默认值Project Defaults

常规General

  • 目标平台Target Platform

    指定项目将在其中运行的平台。Specifies the platform that the project will run on. 例如,Windows、Android 或 iOS。For example, Windows, Android, or iOS. 值“Windows 10”表示面向通用 Windows 平台的项目。The value Windows 10 means the project targets the Universal Windows Platform. 如果面向的是 Windows 的早期版本,则不会列出该版本且此字段中的值将仅显示为 Windows。If you are targeting earlier versions of Windows, the version is not listed and the value in this field appears as just Windows. 这是当你创建项目时将设置的一个只读字段。This is a read-only field that is set when you create a project.

  • Visual Studio 2015 (目标平台版本)Target Platform Version (Visual Studio 2015)

    指定项目可以在其中运行的最低版本平台。Specifies the lowest version of the platform that the project can run on. 此属性仅在项目类型支持时才会出现。This property appears only if the project type supports it. 如果你的应用可以利用较新 Windows SDK 版本中的功能,但仍可以在不包含这些功能的早期版本上运行(可能有一些功能丢失),则这两个属性的值可能不同。If your app can take advantage of features in a newer Windows SDK version, but can still run on earlier versions without those features, perhaps with some loss of functionality, then the value of these two properties might be different. 如果这样,你的代码应检查在运行时它所运行的平台的版本,并且不尝试使用在较旧的平台版本中不可用的功能。If so, your code should check the version of the platform it is running against at runtime and not try to use features that aren't available in older platform version.

    C + + 项目系统不强制执行此选项。The C++ project system does not enforce this option. 包含它是为了与其他语言(如 C# 和 JavaScript)保持一致,并为使用你的项目的任何人提供指南。It is included for consistency with other languages, such as C# and JavaScript, and as a guide for anyone who uses your project. 如果你使用在最低版本中不可用的一个功能,则 Visual C++ 不会生成错误。Visual C++ won't generate an error if you use a feature that is not available in the minimum version.

  • Visual Studio 2017 (Windows SDK 版本)Windows SDK Version (Visual Studio 2017)

    对于 Windows 目标平台,此字段指定项目所需的 Windows SDK 的版本。For the Windows target platform, this specifies the version of the Windows SDK that your project requires. 使用 Visual Studio 安装程序安装 C++ 工作负载时,也会安装所需的 Windows SDK 部件。When you install a C++ Workload by using the Visual Studio installer, the required parts of the Windows SDK are also installed. 如果计算机上有其他 Windows SDK 版本,已安装的每个版本的 SDK 工具都会出现在下拉列表中。If you have other Windows SDK versions on your computer, each version of the SDK tools that you have installed appears in the dropdown.

    若要面向 Windows 7 或 Windows Vista,请使用值 8.1,因为 Windows SDK 8.1 对于那些平台是后向兼容的。To target Windows 7 or Windows Vista, use the value 8.1, since Windows SDK 8.1 is backward compatible to those platforms. 此外,应在 targetver.h 中为 _WIN32_WINNT 定义适当的值。In addition, you should define the appropriate value for _WIN32_WINNT in targetver.h. 对于 Windows 7,即 0x0601。For Windows 7, that's 0x0601. 请参阅修改 WINVER 和 _WIN32_WINNTSee Modifying WINVER and _WIN32_WINNT.

    可以安装 Visual Studio 中内含的 Windows XP 平台工具集,以便使用当前版本的库来生成 Windows XP 和 Windows 2003 Server 项目。You can install the Windows XP platform toolset included in Visual Studio to use the current version of the libraries to build Windows XP and Windows 2003 Server projects. 有关如何获取和使用此平台工具集的信息,请参阅配置适用于 Windows XP 的程序For information on how to obtain and use this platform toolset, see Configuring Programs for Windows XP. 有关更改平台工具集的其他信息,请参阅如何:修改目标框架和平台工具集For additional information on changing the platform toolset, see How to: Modify the Target Framework and Platform Toolset.

  • 输出目录Output Directory

    指定链接器等工具将放置在生成过程中创建的所有最终输出文件的目录。Specifies the directory where tools such as the linker will place all final output files that are created during the build process. 通常,这包括链接器、库管理器或 BSCMake 等工具的输出。Typically, this includes the output of tools such as the linker, librarian, or BSCMake. 此属性在默认情况下是由宏 $(SolutionDir)$(Configuration)\ 指定的目录。By default, this property is the directory specified by the macros $(SolutionDir)$(Configuration).

    若要以编程方式访问此属性,请参阅 OutputDirectoryTo programmatically access this property, see OutputDirectory.

  • 中间目录Intermediate Directory

    指定编译器等工具将放置在生成过程中创建的所有中间文件的目录。Specifies the directory where tools such as the compiler will place all intermediate files created during the build process. 通常,这包括 C/C++ 编译器、MIDL 和资源编译器等工具的输出。Typically, this includes the output of tools such as the C/C++ compiler, MIDL, and the resource compiler. 此属性在默认情况下是由宏 $(Configuration)\ 指定的目录。By default, this property is the directory specified by the macro $(Configuration).

    若要以编程方式访问此属性,请参阅 IntermediateDirectoryTo programmatically access this property, see IntermediateDirectory.

  • 目标名称Target Name

    指定此项目生成的文件名称。Specifies the file name this project generates. 此属性在默认情况下是由宏 $(ProjectName) 指定的文件名。By default, this property is the filename specified by the macro $(ProjectName).

  • 目标扩展名Target Extension

    指定此项目生成的文件扩展名;例如,.exe 或 .dll。Specifies the file name extension this project generates; for example, .exe or .dll.

  • 清除时要删除的扩展名Extensions to Delete on Clean

    “清理”选项(“生成”菜单)从生成项目的配置的中间目录中删除文件。The Clean option (Build menu) deletes files from the intermediate directory where a project's configuration is built. 具有此属性指定的扩展名的文件将在运行“清理”或当你执行重新生成时被删除。Files with extensions specified with this property will be deleted when Clean is run or when you perform a rebuild. 除了中间目录中具有这些扩展名的文件以外,生成系统也将删除任何已知的生成输出,而无论它所在的位置(包括中间输出,如 .obj 文件)。In addition to files of these extensions in the intermediate directory, the build system will also delete any known output of the build regardless of where it is located (including intermediate outputs such as .obj files). 请注意,你可以指定通配符。Note that you can specify wildcard characters.

    若要以编程方式访问此属性,请参阅 DeleteExtensionsOnCleanTo programmatically access this property, see DeleteExtensionsOnClean.

  • 生成日志文件Build Log File

    允许你指定生成项目时创建的日志文件的非默认位置。Allows you to specify a non-default location for the log file that is created whenever you build a project. 默认位置由宏 $(IntDir)$(MSBuildProjectName).log 指定。The default location is specified by the macros $(IntDir)$(MSBuildProjectName).log.

    可使用项目宏来更改目录位置。You can use project macros to change the directory location. 请参阅 用于生成命令和属性的常见宏See Common macros for build commands and properties.

  • 平台工具集Platform Toolset

    允许项目面向不同版本的 Visual C++ 库和编译器。Allows the project to target a different version of the Visual C++ libraries and compiler. Visual Studio c + + 项目可以面向 Visual Studio 安装的默认工具集,也可以是由多个以前版本的 Visual Studio 安装的工具集之一,其中包括用于创建可在 Windows XP 上运行的可执行文件的工具集。Visual Studio C++ projects can target either the default toolset installed by Visual Studio, or one of the toolsets installed by several previous versions of Visual Studio, including toolsets that create executables that can run on Windows XP. 有关更改平台工具集的信息,请参阅如何:修改目标框架和平台工具集For information on changing the platform toolset, see How to: Modify the Target Framework and Platform Toolset.

  • 启用托管增量生成Enable Managed Incremental Build

    对于托管项目,这可在生成程序集时启用外部可见性的检测。For managed projects, this enables detection of external visibility when you generate assemblies. 如果某个托管项目的更改对其他项目不可见,则不重新生成依赖项目。If a change to a managed project is not visible to other projects, then dependent projects are not rebuilt. 对于包括托管项目的解决方案,这样可以显著改善其中的生成时间。This can dramatically improve build times in solutions that include managed projects.

项目默认值Project Defaults

“项目默认设置”部分中的属性表示你可以修改的默认属性。The properties in the Project Default section represent default properties that you can modify. 可以在安装目录\VC\VCProjectDefaults 中的 .props 文件中找到这些属性的定义。The definition for these properties can be found in the .props files in Installation Directory\VC\VCProjectDefaults.

  • 配置类型Configuration Type

    有几种配置类型可供选择:There are several configuration types from which to choose:

    • 应用程序(.exe)Application (.exe)

      显示链接器工具集(C/C++ 编译器、MIDL、资源编译器、链接器、BSCMake、XML Web 服务代理生成器、自定义生成、预生成、链接前、生成后事件)。Displays linker toolset (C/C++ Compiler, MIDL, Resource Compiler, Linker, BSCMake, XML Web Service Proxy Generator, custom build, prebuild, prelink, postbuild events).

    • 动态库(.dll)Dynamic Library (.dll)

      显示链接器工具集,指定 /DLL 链接器选项并将 _WINDLL 定义添加到 CL。Displays linker toolset, specifies /DLL linker option, and adds the _WINDLL define to CL.

    • 生成文件Makefile

      显示生成文件工具集 (NMake)。Displays makefile toolset (NMake).

    • 静态库(.lib)Static Library (.lib)

      显示库管理员工具集(除了链接器的替代库管理器外,其他与链接器工具集相同并且省略了 XML Web 服务代理生成器)。Displays librarian toolset (same as linker toolset except substitute librarian for linker and omit XML Web Service Proxy Generator).

    • 实用程序Utility

      显示实用工具集(MIDL、自定义生成、预生成、生成后事件)。Displays utility toolset (MIDL, custom build, prebuild, postbuild events).

    若要以编程方式访问此属性,请参阅 ConfigurationTypeTo programmatically access this property, see ConfigurationType.

  • MFC 的使用Use of MFC

    指定 MFC 项目将静态还是动态链接到 MFC DLL。Specifies whether the MFC project will statically or dynamically link to the MFC DLL. 非 MFC 项目可以选择“使用标准 Windows 库”以链接到使用 MFC 时将包括在内的各种 Win32 库。Non-MFC projects can select Use Standard Windows Libraries to link to various Win32 libraries that are included when you use MFC.

    若要以编程方式访问此属性,请参阅 useOfMfcTo programmatically access this property, see useOfMfc.

  • 字符集Character Set

    定义应设置 _UNICODE 还是 _MBCS。Defines whether _UNICODE or _MBCS should be set. 在适当的情况下,还会影响链接器入口点。Also affects the linker entry point where appropriate.

    若要以编程方式访问此属性,请参阅 CharacterSetTo programmatically access this property, see CharacterSet.

  • 公共语言运行时支持Common Language Runtime support

    导致要使用 /clr 编译器选项。Causes the /clr compiler option to be used.

    若要以编程方式访问此属性,请参阅 ManagedExtensionsTo programmatically access this property, see ManagedExtensions.

  • .NET 目标框架版本.NET Target Framework Version

    在托管项目中指定要面向的 .NET Framework 版本。In managed projects, specifies the .NET framework version to target.

  • 全程序优化Whole Program Optimization

    指定 /GL 编译器选项和 /LTCG 链接器选项。Specifies the /GL compiler option and /LTCG linker option. 默认情况下,此选项对于调试配置是禁用的,对于零售配置是启用的。By default, this is disabled for Debug configurations, and enabled for Retail configurations.

  • Microsoft Store 应用支持Windows Store App Support

    指定此项目是否支持 Windows 运行时(通用 Windows 平台)应用。Specifies whether this project supports Windows Runtime (Universal Windows Platform) apps. 有关详细信息,请参阅 /ZW(Windows 运行时编译)和 Windows 开发人员中心。For more information, see /ZW (Windows Runtime Compilation), and the Windows Developer Center.

请参阅See also

C++ 项目属性页参考C++ project property page reference