Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Trying to use Newtonsoft Json but get netstandard reference error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to use Newtonsoft Json but get netstandard reference error

    I have a visual studio .Net Framework class library that is symlinked to the indicators directory. I do my compiling in Ninja. Project was working well until I tried to add Newtonsoft.Json.dll from C:\Program Files\NinjaTrader 8\bin.

    Procedure is to add the dll as a reference to class library in visual studio. Then add it as a reference in ninjascript editor. Then compile.

    This only happens when adding Newtonsoft.Json code. If I remove the code and the import then it compiles again.
    ExiaClient.cs The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. CS0012 114 13
    Last edited by bartrader; 04-16-2023, 04:52 PM.

    #2
    Hello bartrader,

    Thanks for your post.

    Using third-party resources such as Newtonsoft in NInjaScript would be outside of what our support could assist with or provide samples of. This is something you will need to diagnose and work through on your end. You can use third-party references in your own programming but this is something you would need to reference in the NinjaScript editor for it to work.

    Have you at this point referenced this DLL in the NinjaScript editor? Dropping the file in the bin/custom folder would only be part of being able to use that DLL. You also need to reference the dll using the NinjaScript editor -> Right Click -> References menu.

    Additionally, if you plan to export the item later, you would need to add the DLL to your export. https://ninjatrader.com/support/help...esOrNativeDlls

    See this forum thread for more information: https://forum.ninjatrader.com/forum/...1037318​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Ok so how can I parse JSON data using nothing other that whats included? Surely something so basic must be possible.

      Comment


        #4
        Hello bartrader,

        Thanks for your note.

        From the compile error in your initial post, it seems that you are using the wrong version of Newtonsoft that was built for NetStandard which is not supported in NinjaScript.

        Third-party dlls need to be built for the .NET 4.8 Framework or less. NetStandard, NetCore, and versions of .NET Framework newer than 4.8 are not supported frameworks for references.

        You may consider referencing the Newtonsoft.Json.dll file located in the C:\Program Files\NinjaTrader 8\bin folder.

        Note that there was an issue with referencing Newtonsoft in a previous version of NinjaTrader 8.1. If you are not updated to NinjaTrader 8 version 8.1.1.3, please do so using the steps below. Updates to NinjaTrader will contain the latest security updates and bug fixes, as well as occasional new features and instruments.

        To update NinjaTrader
        • Shutdown all programs including NinjaTrader *important
        • Download NinjaTrader from the link below
        • Double-click the downloaded file to execute it
        • Follow the on-screen instructions
        • Restart NinjaTrader
        You can read about changes to this release in the release notes linked below.

        https://ninjatrader.com/support/help...ease_notes.htm
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        4 views
        0 likes
        Last Post Rapine Heihei  
        Started by f.saeidi, Today, 08:01 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        6 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Working...
        X