从 Visual C++ 早期版本升级项目Upgrading Projects from Earlier Versions of Visual C++

在大多数情况下,你可以打开在 Visual Studio 早期版本中创建的项目。In most cases, you can open a project that was created in an earlier version of Visual Studio. 但是,为实现这一点,Visual Studio 将升级项目。However, to accomplish this, Visual Studio upgrades the project. 如果你保存升级的该项目,它将无法在早期版本中打开。If you save this upgraded project, it cannot be opened in the earlier version.

重要

如果你尝试转换已转换的项目,Visual Studio 会要求确认,因为重新转换会删除现有文件。If you try to convert a project that was already converted, Visual Studio asks for confirmation because reconversion deletes existing files.

许多升级后的项目和解决方案无需修改即可成功生成。Many upgraded projects and solutions can be built successfully without modification. 但是,某些项目可能需要更改设置和/或源代码。However, some projects might require changes to settings, source code, or both. 我们建议你采用以下指导方针先解决设置问题,如果项目仍未生成,然后再解决代码问题。We recommend that you use the following guidelines to address the settings issues first, and then if the project still doesn't build, you can address the code issues. 有关详细信息,请参阅潜在的升级问题概述For more information, see Overview of potential upgrade issues.

  1. 复制现有项目和解决方案文件。Make a copy of the existing project and solution files. 并行安装 Visual Studio 当前版本和早期版本,以便比较文件的版本(如果需要)。Install the current version of Visual Studio and the earlier version side by side so that you can compare versions of the files if you want to.

  2. 在 Visual Studio 的当前版本中,打开(并因此升级)项目或解决方案的副本并保存。In the current version of Visual Studio, open—and thereby upgrade—the copy of the project or solution and save it.

  3. 对于每个转换的项目,打开快捷菜单并选择 “属性”For each converted project, open the shortcut menu and choose Properties. “配置属性”下,选择 “常规” ,然后为 “平台工具集”选择当前版本。Under Configuration Properties, select General and then for Platform Toolset, select the current version. (例如,为 Visual Studio 2017 选择 v141。)(For example, for Visual Studio 2017, select v141.)

  4. 生成解决方案。Build the solution. 如果生成失败,请修改设置并重新生成。If the build fails, modify the settings and rebuild.

    数据源包含在单独的数据库项目中,以便你更轻松地在这些源中修改和调试存储过程。Data sources are contained in a separate database project so that you can more easily modify and debug the stored procedures in those sources. 如果你升级包含数据源的 C++ 项目,则会自动创建单独的数据库项目。If you upgrade a C++ project that contains data sources, a separate database project is automatically created.

    有关如何更新目标 Windows 版本的信息,请参阅修改 WINVER 和 _WIN32_WINNTFor information about how to update the targeted Windows versions, see Modifying WINVER and _WIN32_WINNT.

另请参阅See Also

生成系统更改Build System Changes
Visual Studio 2017 中 Visual C++ 的新增功能Visual C++ 更改历史记录(2003 - 2015) What's New for Visual C++ in Visual Studio 2017 Visual C++ change history 2003 - 2015
非标准行为Nonstandard Behavior