Friday, January 22, 2021

Migrating Projects Created with Visual Studio Versions Earlier than 2010

Migrating Projects Created with Visual Studio Versions Earlier than 2010

the first post has very good summary and I toook notes for my reference.

  1. 加湿器千万不能这样用!可能造成肺部损伤
  2. Changing the default executable path for Visual Studio 2017 and above
  3. This article explains how to set the default executable path for every new Visual Studio project. This can be useful for binding new custom executables located in a custom directory. This article explains also how to revert to the default settings in the case of a broken path.

  4. Migrating Projects Created with Visual Studio Versions Earlier than 2010
  5. Global IDE Pathing

    Global IDE directory paths are no longer supported, meaning that Tools > Options > VC++ Directories no longer exists. Instead, this has been moved to *.vcxproj file properties, at Project > Properties > Configuration Properties > VC++ Directories.

    Setting Target Names

    One way to resolve the warning is to manually set the Target Name and TargetExt macros in the project properties. To set the Target Name and Target Extension, select Project > Properties and go to the General options to set the Target Name. Use the $(TargetName)$(TargetExt) macro in the project settings for any necessary references.

    Some suggestions for these macro settings are:

    • Target Name: $(ProjectName)
    • Target Ext: exe, dll, lib, etc. as required by your application

    Further suggested settings for these Project properties are:

    1. Set Configuration Properties | Linker | General | Output file to $(OutDir)$(TargetName)$(TargetExt).
    2. Set Configuration Properties | General | Output Directory to “desired directory path”, which could also be prefixed with $(Platform)\$(Configuration)\.
    3. Set Configuration Properties | General | Intermediate Directory to “desired directory path” which could also be prefixed with $(Platform)\$(Configuration)\.
    4. Set Configuration Properties | General | Target Name to “desired name for output file”
    5. Set Configuration Properties | General | Target Extension to “desired output file extension” (include the preceding dot).
    The “desired directory path” is user-defined and should match the end-user’s environment needs.

    Using Precompiled Headers

    To use precompiled header files in a project:

    1. Right click on the project and select Properties. Under Configuration Properties > C/C++ > Pre Compiled Headers, for all configurations, select Use /Yu for the Precompiled Header option. Select OK.
    2. Expand the project in the Solution Explorer and locate the file called stdafx.cpp, or the similar project main cpp file, then right click and select Properties. Under Configuration Properties > C/C++ > Pre Compiled Headers, for all configurations, select Create /Yc for the Precompiled Header option. Select OK.

    Remove MBCS Character Set

    To remove the MBCS as the character set in your project, change the Character Set to Not Set or Unicode under the project settings Configuration Properties > General -> Character Set.

    Suppress MBCS Warnings

    To suppress warnings about MBCS, define the following macro in your stdafx.h or another appropriate header file:

    #define NO_WARN_MBCS_MFC_DEPRECATION

    http://blogs.msdn.com/b/vcblog/archive/2013/07/08/mfc-support-for-mbcs-deprecated-in-visual-studio-2013.aspx Some Stingray samples do not suppress this warning because it is displayed via the inclusion of MFC header files that precede Stingray header files.

    Output Files Warnings

    In Visual Studio 2013, if warnings are issued about being unable to locate vc120.pdb, then change the project properties to use $(IntDir)$(TargetName).pdb or similar in the Configuration Properties > C/C++ > Output Files setting.

    now in Visual Studio 2017, Configuration Properties > C/C++ > Output Files setting has an item Program Database File Name, it is set to: $(IntDir)vc$(PlatformToolsetVersion).pdb. its value is Debug\vc141.pdb

    Deploying to the Target Platform

    When an application has been built with one of the Microsoft Visual Studio platform toolsets, it can then be deployed to the platform for that toolset, assuming the deployment platform has the targeted Windows- and Compiler-specific runtimes (redistributable package) installed. An application will not run on the targeted platform unless the targeted Windows- and Compiler-specific runtimes, especially MFC runtimes, are present.

    For Dynamic Link Library (DLL) applications, any DLLs the application depends on will need to be copied to the target platform machine.

    For information regarding the minimum service pack levels for Microsoft VC++ Redistributable Packages, refer to: http://support.microsoft.com/kb/2661358.

    Redistribution packages can be downloaded from these locations:

    • Download Visual C++ Redistributable Packages for Visual Studio 2015 from https://www.microsoft.com/en-us/download/details.aspx?id=48145
    • Download Visual C++ Redistributable Packages for Visual Studio 2013 from http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784.
    • Download Visual C++ Redistributable Packages for Visual Studio 2012 Update 4 from http://www.microsoft.com/en-us/download/confirmation.aspx?id=30679.

    Target Names

    Projects that have been converted from an earlier version of Microsoft Visual Studio to versions MSVS 2010 SP1 through MSVS 2013, may generate warnings that the Target Name and the Output Name do not match.

    Warning MSB8012 is displayed at the end of the library/assembly build in the output window:

    1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\\Microsoft.CppBuild.targets(1095,5): warning MSB8012: TargetPath() does not match the Library's OutputFile property value ().

      This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

    This is a known issue, which you can read more about in these locations:

  6. How to: Modify the Target Framework and Platform Toolset
  7. You can edit a Visual Studio C++ project file to target different versions of the C++ platform toolset, the Windows SDK and the .NET Framework (C++/CLI projects only). By default, the project system uses the .NET Framework version and the toolset version that correspond to the version of Visual Studio that you use to create the project. You can modify all these values in the .vcxproj file so that you can use the same code base for every compilation target.

    Platform toolset

    The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Since Visual Studio 2015, the major version of the toolset has remained at 14, which means that projects compiled with Visual Studio 2019 or Visual Studio 2017 are ABI-backwards-compatible with projects compiled with Visual Studio 2015. The minor version has updated by 1 for each version since Visual Studio 2015:

    1. Visual Studio 2015: v140
    2. Visual Studio 2017: v141
    3. Visual Studio 2019: v142

    These toolsets support .NET Framework 4.5 and later.

    Visual Studio also supports multitargeting for C++ projects. You can use the Visual Studio IDE to edit and build projects that were created with older versions of Visual Studio, without upgrading them to use a new version of the toolset. You do need to have the older toolsets installed on your computer. For more information, see How to use native multi-targeting in Visual Studio. For example, in Visual Studio 2015, you can target .NET Framework 2.0 but you must use an earlier toolset that supports it.

    To change the platform toolset

    1. In Visual Studio, in Solution Explorer, open the shortcut menu for your project (not for your solution) and then choose Properties to open your project Property Pages dialog box.
    2. In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
    3. In the left pane of the dialog box, expand Configuration Properties and then select General.
    4. In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you have installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project.
    5. Choose the OK button.

    Targeting Windows XP

    Some versions of Microsoft Visual Studio allow targeting Windows XP specifically. To specifically target Windows XP, choose a platform toolset option with a *_xp identifier, such as v120_xp or v110_xp. See the next section for information on how to choose the platform toolset.

    Not all C++ runtime features are supported when targeting Windows XP. Please refer to the following article for more information on targeting Windows XP: http://msdn.microsoft.com/en-us/library/vstudio/jj851139.aspx.

  8. How to: Configure Visual Studio C++ projects to Target 64-Bit, x64 Platforms
  9. This is a paragraph.

  10. Configuring Programs for Windows XP
  11. Visual Studio supports multiple platform toolsets. That means it's possible to target operating systems and runtime libraries that aren't supported by the default toolset. For example, by switching the platform toolset, you can use the Visual Studio 2017 C++ compiler to create apps that target Windows XP and Windows Server 2003. You can also use older platform toolsets to maintain binary-compatible legacy code and still take advantage of the latest features of the Visual Studio IDE.

    The v142 toolset supplied in Visual Studio 2019 doesn't include support for creating code for Windows XP. Support for Windows XP development by using the Visual Studio 2017 v141_xp toolset is available as an individual component option in the Visual Studio Installer.

  12. Chapter 6 Support for the MFC Feature Pack
  13. What is the FoundationEx library? The Stingray Studio FoundationEx library is a new set of application, docking, frame, and user interface classes built on the MFC Feature Pack for Microsoft Visual Studio 2008 SP1 or later. The FoundationEx library is designed to be used with all Stingray Studio products. Some existing applications previously built with Stingray Studio 10.1 and earlier will need to be migrated to use the FoundationEx library in order to take advantage of any new features in the MFC Feature Pack.

No comments:

Post a Comment