Newtonsoft.Json icon indicating copy to clipboard operation
Newtonsoft.Json copied to clipboard

Unable to add Newtonsoft to C++ CLI project using Nuget in Visual Studio 2017

Open Jesus805 opened this issue 7 years ago • 6 comments

Hello,

I am getting an error when trying to install Newtonsoft.Json 11.0.1 to my Visual Studio 2017 C++/CLI Project using Nuget Package Manager.

When I try to install it I get this error: "Could not install package 'Newtonsoft.Json 11.0.1'. 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."

I was able to work around this by downloading the package on a C# project and referencing the dll on my C++/CLI but it would be nice if I could install the package directly for easy management.

Cheers

Jesus805 avatar Feb 24 '18 00:02 Jesus805

I noticed that I had no problems adding ZXing .NET to my project because it has

native,Version=0.0 No dependencies

Under "Dependencies"

Jesus805 avatar Feb 26 '18 19:02 Jesus805

Hello,

I am getting an error when trying to install Newtonsoft.Json 11.0.1 to my Visual Studio 2017 C++/CLI Project using Nuget Package Manager.

When I try to install it I get this error: "Could not install package 'Newtonsoft.Json 11.0.1'. 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."

I was able to work around this by downloading the package on a C# project and referencing the dll on my C++/CLI but it would be nice if I could install the package directly for easy management.

Cheers

Hello, I'm having the same issue. I can't seem to reference the C# dll in my C++ project. Can you please give me some tips?

kbrizov avatar Oct 01 '18 09:10 kbrizov

Hi, The work around that I did was create a new C# application and downloaded Newtonsoft.Json using Nuget. Then on my C++ project I referenced "<C# project>\packages\Newtonsoft.Json.11.0.1\lib\netXX\Newtonsoft.Json.dll".

Jesus805 avatar Oct 01 '18 16:10 Jesus805

Hi, The work around that I did was create a new C# application and downloaded Newtonsoft.Json using Nuget. Then on my C++ project I referenced "<C# project>\packages\Newtonsoft.Json.11.0.1\lib\netXX\Newtonsoft.Json.dll".

Thanks. It's interesting because C# dlls are supposed to be different "managed" dlls. It doesn't let me reference them in a C# project. Am I missing something?

kbrizov avatar Oct 05 '18 08:10 kbrizov

Hi all, I am having same problem here with C++ and adding this library to my project. @Jesus805 where and how did you referenced that dll?

markosole avatar Apr 06 '22 20:04 markosole

Ended up using what is described and here: https://stackoverflow.com/a/58589854 Downloading .nuget package and extracking dll and xml then including into project.

markosole avatar Feb 21 '25 11:02 markosole