|
1 | 1 | --- |
2 | 2 | title: "Upgrade C++ projects from earlier versions of Visual Studio" |
3 | 3 | description: "How to upgrade Microsoft C++ projects from older versions of Visual Studio." |
4 | | -ms.date: "10/29/2019" |
| 4 | +ms.date: "01/21/2020" |
5 | 5 | helpviewer_keywords: ["32-bit code porting", "upgrading Visual C++ applications, 32-bit code"] |
6 | 6 | ms.assetid: 18cdacaa-4742-43db-9e4c-2d9e73d8cc84 |
7 | 7 | --- |
8 | 8 | # Upgrade C++ projects from earlier versions of Visual Studio |
9 | 9 |
|
10 | | -To upgrade a project created in Visual Studio 2008 or earlier, you must first use Visual Studio 2010 to convert the project from the VCBuild format (.vcproj) to the MSBuild format (.vcxproj). For more information, see [Instructions for Visual Studio 2008](use-native-multi-targeting.md#instructions-for-visual-studio-2008). |
| 10 | +To upgrade a project created in an earlier version of Visual Studio, just open the project in the latest version of Visual Studio. Visual Studio offers to upgrade the project to the current schema. |
11 | 11 |
|
12 | | -To upgrade a project created in Visual Studio 2010 or later, simply open the project in the latest version of Visual Studio. Visual Studio offers to upgrade the project to the current schema. If you choose **No**, and you have the older version of Visual Studio on your computer, you can work in the project in a newer version of Visual Studio and continue to target the older toolset. For example, if your project must continue to run on Windows XP, you can upgrade it to Visual Studio 2019, but you have to specify the toolset as v141 or earlier. For more information, see [Use native multi-targeting in Visual Studio to build old projects](use-native-multi-targeting.md). If you choose **Yes**, then the project will be converted and cannot be converted back to the earlier version. Therefore, in upgrade scenarios, it is good practice to make a copy of the existing project and solution files. |
| 12 | +If you choose **No**, the project doesn't get upgraded. For projects created in Visual Studio 2010 and later, you can still use the project in the newer version of Visual Studio. Just set your project properties to continue to target the older toolset. If you leave the older version of Visual Studio on your computer, its toolset is available in later versions. For example, if your project must continue to run on Windows XP, you can upgrade to Visual Studio 2019. You then specify the toolset as v141_xp or earlier in your project properties. For more information, see [Use native multi-targeting in Visual Studio to build old projects](use-native-multi-targeting.md). |
| 13 | + |
| 14 | +If you choose **Yes**, then the project gets upgraded in place. It can't be converted back to the earlier version. In upgrade scenarios, that's why it's good practice to make a backup copy of the existing project and solution files. |
13 | 15 |
|
14 | 16 | ## Upgrade reports |
15 | 17 |
|
16 | | -When you upgrade a project, you get an upgrade report, which is also saved in your project folder as UpgradeLog.htm. The upgrade report shows a summary of what problems were encountered and some information about changes that were made, including: |
| 18 | +When you upgrade a project, you get an upgrade report. The report is also saved in your project folder as UpgradeLog.htm. The upgrade report shows a summary of what problems were found during conversion. It lists some information about changes that were made, including: |
| 19 | + |
| 20 | +- Project properties. |
| 21 | + |
| 22 | +- Include files. |
| 23 | + |
| 24 | +- Code that no longer compiles cleanly because of compiler conformance improvements or changes in the standard. |
| 25 | + |
| 26 | +- Code that relies on Visual Studio or Windows features that are no longer available. Or, header files that either aren't included in a default installation of Visual Studio, or were removed from the product. |
| 27 | + |
| 28 | +- Code that no longer compiles because of changes in APIs such as renamed APIs, changed function signatures, or deprecated functions. |
| 29 | + |
| 30 | +- Code that no longer compiles because of changes in diagnostics, such as a warning becoming an error |
| 31 | + |
| 32 | +- Linker errors because of libraries that were changed, especially when /NODEFAULTLIB is used. |
17 | 33 |
|
18 | | -1. Project properties |
| 34 | +- Runtime errors or unexpected results because of behavior changes. |
19 | 35 |
|
20 | | -2. Include files |
| 36 | +- Errors that were introduced in the tools. If you find an issue, report it to the Visual C++ team through your normal support channels or by using the [Visual Studio C++ Developer Community](https://developercommunity.visualstudio.com/spaces/62/index.html) page. |
21 | 37 |
|
22 | | -3. Code that no longer compiles cleanly due to compiler conformance improvements or changes in the standard |
| 38 | +Some upgraded projects and solutions can be built successfully without modification. However, most projects will likely require changes to both project settings and your source code. There's no single correct way to go about fixing these issues, but we recommend using a phased approach. Before you start, review [Overview of potential upgrade issues](../porting/overview-of-potential-upgrade-issues-visual-cpp.md) for more information on many kinds of common errors. |
23 | 39 |
|
24 | | -4. Code that relies on Visual Studio or Windows features that are no longer available or header files that either aren't included in a default installation of Visual Studio, or were removed from the product |
| 40 | +1. Set the Platform Toolset, C++ Language Standard, and Windows SDK version (if applicable) to the preferred versions. (**Project** > **Properties** > **Configuration Properties** > **General**) |
25 | 41 |
|
26 | | -5. Code that no longer compiles due to changes in APIs such as renamed APIs, changed function signatures, or deprecated functions |
| 42 | +1. If you have lots of errors, you can temporarily turn off some options while you fix them. To turn off the [/permissive-](../build/reference/permissive-standards-conformance.md) option, use **Project** > **Properties** > **Configuration Properties** > **C/C++** > **Language**. To turn off the [code analysis](/visualstudio/code-quality/code-analysis-for-c-cpp-overview) option, use **Project** > **Properties** > **Configuration Properties** > **Code Analysis**. |
27 | 43 |
|
28 | | -6. Code that no longer compiles due to changes in diagnostics, such as a warning becoming an error |
| 44 | +1. Ensure that all dependencies are present and that the include paths or library locations are correct. (**Project** > **Properties** > **Configuration Properties** > **VC++ Directories**) |
29 | 45 |
|
30 | | -7. Linker errors due to libraries that were changed, especially when /NODEFAULTLIB is used. |
| 46 | +1. Identify and fix errors caused by references to APIs that no longer exist. |
31 | 47 |
|
32 | | -8. Runtime errors or unexpected results due to behavior changes |
| 48 | +1. Fix any remaining errors that prevent compilation. Refer to [Overview of potential upgrade issues](../porting/overview-of-potential-upgrade-issues-visual-cpp.md) for fixes for common errors. |
33 | 49 |
|
34 | | -9. Errors that were introduced in the tools. If you encounter an issue, report it to the Visual C++ team through your normal support channels or by using the [Visual Studio C++ Developer Community](https://developercommunity.visualstudio.com/spaces/62/index.html) page. |
| 50 | +1. Turn **/permissive-** back on and fix any new errors caused by non-conformant code that previously compiled in MSVC. |
35 | 51 |
|
36 | | -Some upgraded projects and solutions can be built successfully without modification. However, most projects will likely require changes to project settings as well as source code. There is no single correct way to go about fixing these, but some kind of phased approach is recommended. Before starting, review [Overview of potential upgrade issues](../porting/overview-of-potential-upgrade-issues-visual-cpp.md) for more information on many kinds of common errors. |
| 52 | +1. Turn on code analysis to identify potential problems or outdated coding patterns that are no longer considered acceptable. If code analysis flags many errors, you can turn off some of the warnings to focus on the most important ones first. The IDE can help with Quick Fixes for some kinds of issues. |
37 | 53 |
|
38 | | - 1. Set the Platform Toolset, C++ Language Standard, and Windows SDK version (if applicable) to the desired versions. (**Project** > **Properties** > **Configuration Properties** > **General**) |
39 | | - 1. If you have a lot of errors, turn off the [permissive-](../build/reference/permissive-standards-conformance.md) option (**Project** > **Properties** > **Configuration Properties** > **C/C++** > **Language**) and [code analysis](/visualstudio/code-quality/code-analysis-for-c-cpp-overview) (**Project** > **Properties** > **Configuration Properties** > **Code Analysis**) option temporarily to reduce the error count. |
40 | | - 1. Ensure that all dependencies are present and that the include paths or library locations are correct. (**Project** > **Properties** > **Configuration Properties** > **VC++ Directories**) |
41 | | - 1. Identify and fix errors due to references to APIs that no longer exist. |
42 | | - 1. Fix any remaining errors that prevent compilation. Refer to [Overview of potential upgrade issues](../porting/overview-of-potential-upgrade-issues-visual-cpp.md) for fixes for common errors. |
43 | | - 1. Turn **permissive-** back on and fix any new errors that appear due to non-conformant code that previously compiled in MSVC. |
44 | | - 1. Turn on code analysis to identify potential problems or outdated coding patterns that are no longer considered acceptable. If code analysis flags many errors, you can turn off some of the warnings to focus on the most important ones first. The IDE can help with Quick Fixes for some kinds of issues. |
45 | | - 1. Consider other opportunities for modernizing the code, for example by replacing custom data structures and algorithms with those from the C++ standard library or the Boost open-source library. By using standard features, you make it easier for others to maintain the code and also have a strong confidence that the code has been well-tested and reviewed by many experts on the standards committee and the broader C++ community. |
| 54 | +1. Consider other opportunities for modernizing the code. For example, replace custom data structures and algorithms with ones from the C++ standard library, or the Boost open-source library. By using standard features, you make it easier for others to maintain the code. You can be confident that this code has been well-tested and reviewed by many experts on the standards committee and the broader C++ community. |
46 | 55 |
|
47 | 56 | For hard-to-fix errors, try searching or posting a question on Stack Overflow or [C++ Developer Community](https://developercommunity.visualstudio.com/spaces/62/index.html). |
48 | 57 |
|
49 | 58 | ## In this section |
50 | 59 |
|
51 | | -[Overview of potential upgrade issues](overview-of-potential-upgrade-issues-visual-cpp.md)<br/> |
52 | | -[Upgrade your code to the Universal CRT](upgrade-your-code-to-the-universal-crt.md)<br/> |
53 | | -[Update WINVER and _WIN32_WINNT](modifying-winver-and-win32-winnt.md)<br/> |
54 | | -[Fix your dependencies on library internals](fix-your-dependencies-on-library-internals.md)<br/> |
55 | | -[Floating-point migration issues](floating-point-migration-issues.md)<br/> |
56 | | -[C++ features deprecated in Visual Studio 2019](features-deprecated-in-visual-studio.md)<br/> |
57 | | -[VCBuild vs. MSBuild](build-system-changes.md)<br/> |
58 | | -[Port 3rd-party libraries](porting-third-party-libraries.md)<br/> |
| 60 | +[Overview of potential upgrade issues](overview-of-potential-upgrade-issues-visual-cpp.md)\ |
| 61 | +[Upgrade your code to the Universal CRT](upgrade-your-code-to-the-universal-crt.md)\ |
| 62 | +[Update WINVER and _WIN32_WINNT](modifying-winver-and-win32-winnt.md)\ |
| 63 | +[Fix your dependencies on library internals](fix-your-dependencies-on-library-internals.md)\ |
| 64 | +[Floating-point migration issues](floating-point-migration-issues.md)\ |
| 65 | +[C++ features deprecated in Visual Studio 2019](features-deprecated-in-visual-studio.md)\ |
| 66 | +[VCBuild vs. MSBuild](build-system-changes.md)\ |
| 67 | +[Port 3rd-party libraries](porting-third-party-libraries.md) |
59 | 68 |
|
60 | 69 | ## See also |
61 | 70 |
|
62 | | -[What's New for Visual C++ in Visual Studio](../overview/what-s-new-for-visual-cpp-in-visual-studio.md)<br/> |
63 | | -[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)<br/> |
64 | | -[Nonstandard Behavior](../cpp/nonstandard-behavior.md)<br/> |
65 | | -[Port data applications](../data/data-access-programming-mfc-atl.md)<br/> |
| 71 | +[What's New for Visual C++ in Visual Studio](../overview/what-s-new-for-visual-cpp-in-visual-studio.md)\ |
| 72 | +[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)\ |
| 73 | +[Nonstandard Behavior](../cpp/nonstandard-behavior.md)\ |
| 74 | +[Port data applications](../data/data-access-programming-mfc-atl.md) |
0 commit comments