一、 修改项目文件
-
这将为你的项目卸载项目文件 (.vcxproj)。
-
“打开文件”对话框中,导航到项目文件夹,然后打开项目文件 (.vcxproj)。
-
<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 useVisual Studio 2008runtime binaries, -
TargetFrameworkVersion: v3.5 (or less), - In the preprocessor you can have
_WIN32_WINNTdefined (e.g._WIN32_WINNT=0x0500)
.NET 4.0 or higher:
-
Platform Toolset: v100, which will useVisual Studio 2010runtime 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