我们公司过去常常使用VS2010构建一个C ++项目,该项目引用了一个针对.NET 4.0框架的C#项目。 一切似乎都运行良好。
Our company used to use VS2010 to build a C++ project that referenced a C# project that target .NET 4.0 framework. Everything seems to work fine.
然后我们决定转向VS2015专业和最新的.NET框架。解决方案似乎可以正确转换,但是,当我尝试将C#项目更改为目标.NET4.6.2时,引用它的C ++项目开始抱怨不能使用该C#引用中的任何帮助函数。 然后我尝试删除并重新添加项目,我收到以下错误。
Then we decided to move to VS2015 professional and latest .NET framework. Solution seems to be converted properly, however, when I tried to change the C# project to target .NET4.6.2, the C++ project that referenced it start to complain about cannot use any helper function from that C# reference. Then I tried to remove and re-add the project, and I got the following error.
发生了一个或多个错误。
One or more error occurred.
参考< project>无法添加,因为它与此项目不兼容。
A referenced to <project> cannot be added because it is incompatible with this project.
C ++项目默认使用:
The C++ project default using:
目标平台版本:8.1
Target Platform Version: 8.1
平台工具集:Visual Studio 2015(v140)
Platform Toolset: Visual Studio 2015 (v140)
我已将Target Platform更改为10.0.14393.0。 问题仍然存在。
I've changed Target Platform to 10.0.14393.0. Problem still exist.
然后我尝试将C#项目更改为目标.NET 4.6或4.5,我仍然无法将项目添加到C ++项目,直到我将其更改回来到.NET 4然后它允许我添加。
Then I tried to change the C# project to target .NET 4.6 or 4.5, I still can't add the project to the C++ project until I change it back to .NET 4 then it allows me to add.
任何帮助将不胜感激。
谢谢,
Gary
推荐答案
您好,
您还应该更改C ++ \ CLI项目目标版本,用于卸载然后右键单击它并选择"Edid --- .vcxproj"。将目标框架替换为4.6.1保存并重新加载项目。现在再试一次添加引用。
You should also change your C++\CLI project target version, for that unload It then right click on it and select "Edid ---.vcxproj" replace target framework to 4.6.1 save and reload project . Now try again add reference.
更多推荐
无法添加C#.NET4.6.2项目作为C ++项目的参考
发布评论