欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

visual studio如何修改c++项目的.net framework框架版本

发布时间:2023/12/4 52 豆豆
生活随笔 收集整理的这篇文章主要介绍了 visual studio如何修改c++项目的.net framework框架版本 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

一、 修改项目文件

  • 在 Visual Studio 的“解决方案资源管理器”中,打开项目的快捷菜单,然后选择“卸载项目”。 这将为你的项目卸载项目文件 (.vcxproj)。

  • 在菜单栏上,依次选择“文件”、“打开”、“文件”。 “打开文件”对话框中,导航到项目文件夹,然后打开项目文件 (.vcxproj)。

  • 在项目文件中,找到目标 Framework 版本的条目。 例如,如果你的项目设计为使用 .NET Framework 4.5, <PropertyGroup Label="Globals">元素中找到 请在<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 元素, 如果 <TargetFrameworkVersion> 元素不存在,则新增之,并修改相应版本号。

  •  二、修改.props文件,使工具集与.net框架匹配

    Another thing I learned on the way is that you cannot mix values of Platform Toolset and Target Framework Version.

    The possible combinations I found where:

    .NET 3.5 or less:

    • Platform Toolset: v90, which will use Visual Studio 2008 runtime binaries,
    • TargetFrameworkVersion: v3.5 (or less),
    • In the preprocessor you can have _WIN32_WINNT defined (e.g. _WIN32_WINNT=0x0500)

    .NET 4.0 or higher:

    • Platform Toolset: v100, which will use Visual Studio 2010 runtime binaries,
    • TargetFrameworkVersion: v4.0 (or higher),
    • In the preprocessor you must not have the '_WIN32_WINNT=0x0500' defined

     

     

    参见:

    1.https://msdn.microsoft.com/zh-cn/library/Ff770576.aspx

    2.http://stackoverflow.com/questions/18571546/clr-cli-linker-fails-with-error-lnk2022-custom-attributes-are-not-consistent

    转载于:https://www.cnblogs.com/erentec/p/4886083.html

    总结

    以上是生活随笔为你收集整理的visual studio如何修改c++项目的.net framework框架版本的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。