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


一、 修改項目文件

  1. 在 Visual Studio 的“解決方案資源管理器”中,打開項目的快捷菜單,然后選擇“卸載項目”。 這將為你的項目卸載項目文件 (.vcxproj)。

  2. 在菜單欄上,依次選擇“文件”、“打開”、“文件”。 “打開文件”對話框中,導航到項目文件夾,然后打開項目文件 (.vcxproj)。

  3. 在項目文件中,找到目標 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 Toolsetv90, which will use Visual Studio 2008 runtime binaries,
  • TargetFrameworkVersionv3.5 (or less),
  • In the preprocessor you can have _WIN32_WINNT defined (e.g. _WIN32_WINNT=0x0500)

.NET 4.0 or higher:

  • Platform Toolsetv100, which will use Visual Studio 2010 runtime binaries,
  • TargetFrameworkVersionv4.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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM