Cannot add a reference to PCL from C++/Cli project

2019-06-11 08:42发布

问题:

I have a Portable Class Library project, Net 4.5 platform activated. I can use it in other C# projects without problems. Now, I have a C++/Cli project and I need to use some classes of the above PCL project. When I add the reference to the PCL project, Visual Studio 2012 gives me an error because of different target platforms.

Is there a problem to add references to PCL projects from C++/Cli projects?

Thank you

回答1:

This questionas was replied but for some unknown reason, the response has been deleted:

The solution is to edit the vcxproj file and change

 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

to

 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>