Forum

Newtonsoft.Json in a new node library like VL.DemoLib

Hi, I created my own node library and I am able to add my new test node to a patch just fine. However, as soon as I add a reference to Newtonsoft.Json, I get an error that it cannot be found when I try to install my blibrary. Is there anything that I need to do to include a reference like this in my library?

I’m using “dotnet pack” to create my nuget.

My .csproj file has a reference like this in it like this …

<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />

I try to install my local nuget package like this …
Thanks
–Andy

I think newtonsoft json is already included in vvvv core, likely you are trying to reference library that already referenced, but with another version…

Try to search for it in dependency section…

I’m not seeing it there, this happens to other packages though too like AutoMapper.
I’m wondering now if I need to publish my lib to a feed first before I can use “nuget install”.
Looking up how to do that locally.
–Andy

In the past I had a lot of incompatibility issues with Newtonsoft.Json (mainly because every nuget and its grandma used a different version)
Since then I have come to appreciate System.Text.Json a lot, it has become my go-to lib for every custom serialisation I do.

It seems you’re using the powershell commandlet. Can you try using the nuget.exe?
The syntax should be
nuget install Weston.LibTest -version 1.0.0 -source C:\Users\awest\source\repos\Weston.VL\...\bin\Debug -source nuget.org -nocache
The -nocache can be useful if you re-package without increasing the version.

Thanks @velcrome, I agree with you on that one, I chose Newtonsoft just as a way to narrow down my nuget problem (not a good choice)

Thanks @Elias, you made me realize that I had to setup a local source that nuget.exe could read. I did that like this …

nuget add bin\Debug\Weston.LibTest.1.0.0.nupkg -source c:\packages
nuget install Weston.LibTest -source c:\packages

image
I’m excited to get this going now, vvvv is cool and I’m only starting to realize what I can do with this now.

Cheers
–Andy

4 Likes