You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a C++/CLI project which uses both native and managed code.
It is a common pattern where you have a native class implementation with core functionality, and a managed class exposed to external C# code. This managed class needs to use .Net NuGet packages, not native ones.
In Visual Studio 2019 16.9.0 when I try to add a NuGet package such as PCSC or NLog or Newtonsoft.Json to a C++/CLI project I am getting an error:
Could not install package 'PCSC 5.0.0'. You are trying to install this package into a project that targets 'native,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
In the project I am already providing the correct target for managed code:
Is there a way to override NuGet behavior for C++/CLI projects, apart from installing/restoring the package manually as a pre-build step using command line, and then specifying the package reference in the .vcxproj file (either manually or by using Add reference -> Browse):
If there is no way to do that, then this issue should be considered a feature request instead of a question.
The text was updated successfully, but these errors were encountered:
levicki
changed the title
[QUESTION] How to use Nuget packages in C++/CLI project?
[QUESTION] How to use NuGet packages in a C++/CLI project?
Mar 11, 2021
I have a C++/CLI project which uses both native and managed code.
It is a common pattern where you have a native class implementation with core functionality, and a managed class exposed to external C# code. This managed class needs to use .Net NuGet packages, not native ones.
In Visual Studio 2019 16.9.0 when I try to add a NuGet package such as PCSC or NLog or Newtonsoft.Json to a C++/CLI project I am getting an error:
In the project I am already providing the correct target for managed code:
Is there a way to override NuGet behavior for C++/CLI projects, apart from installing/restoring the package manually as a pre-build step using command line, and then specifying the package reference in the
.vcxproj
file (either manually or by using Add reference -> Browse):If there is no way to do that, then this issue should be considered a feature request instead of a question.
The text was updated successfully, but these errors were encountered: