JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.84k stars 3.26k forks source link

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

Open Jesus805 opened 6 years ago

Jesus805 commented 6 years ago

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 commented 6 years ago

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

native,Version=0.0 No dependencies

Under "Dependencies"

kbrizov commented 6 years ago

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?

Jesus805 commented 6 years ago

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".

kbrizov commented 6 years ago

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?

markosole commented 2 years ago

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?