Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help adding a reference

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

    Help adding a reference

    I have created a simple class using my dotnet CLI like this and added some functions I want to reference:
    Code:
    new classlib -o SjFunctions
    I then built it like this:
    Code:
    dotnet build
    I have followed the instructions in this article:


    However, after I add my using statement and right click the NT editor and add the reference, I get this error:
    Code:
    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'
    I opened my .csproj file and the target framework is netstandard2.0. I tried changing this to this but it did not help:
    Code:
    netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
    Here is a simple example of the structure of my class:
    Code:
    using System;
    using System.IO;
    using System.Text;
    using System.Net;
    using System.Net.Http;
    using System.Net.Sockets;
    
    namespace SjFunctions
    {
        public class Sj{
            public void Put(string path, string content){
                using (FileStream fs = File.Create(path))     
                {    
                    Byte[] data = new UTF8Encoding(true).GetBytes(content);    
                    fs.Write(data, 0, data.Length);    
                }              
            }        
        }
    }
    Any help would be appreciated.

    #2
    Hello swcooke,

    It looks like you are not using .NET framework, you are using dotnet core/standard which is not the same. The error notes you are using netstandard which is not used in NinjaTrader.

    To make an assembly you would need to use visual studio and create a .NET Framework 4.8 or less library (.dll). All other versions of C# will not work with NinjaTrader.

    You can find some infomration which describes netcore and .net framework here: https://www.c-sharpcorner.com/articl...-and-net-core/

    I look forward to being of further assistance.
    Last edited by NinjaTrader_ChelseaB; 06-07-2021, 11:40 AM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    561 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    325 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X