Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I compile my NT Custom .sln when an error shuts down the front end on start?

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

    How do I compile my NT Custom .sln when an error shuts down the front end on start?

    In particular, is there a way to compile the solution from:

    1. The command line?
    2. Inside NT8 Safe Mode? No matter what I've tried so far, the compile button stays disabled.

    The backstory is that I have a most of my engine in a DLL and occasionally I'll make a change that causes the currently compiled AddOn to look for an export that is no longer there. When this happens, the NT8 client shuts down immediately on launch, before I can compile the code from within the editor to fix the problem. But the new code compiles fine in VS2022, so I just need to somehow get NT8 to compile the new code before it shuts down.

    When I eventually figure out the magic thing that I need to add back so that whatever DLL got created from the prior NT8 editor compile of NinjaTrader.Custom.sln starts inside NT8, then everything goes back to working.

    The problem is that this process can be quite time-consuming/painful, b/c the errors in the log and trace files are often red herrings or not helpful. So it's a little like trying to deduce a compile problem without an error to point you at where.

    Any guidance you can provide here would be much appreciated.

    Cheers,
    Peter


    #2
    FWIW, I figured out a relatively quick solve to this problem:

    1. Shut down NT8.
    2. Rename NinjaTrader.Custom.dll to something weird.
    3. Relaunch NT8.
    4. When you get the error dialog, do not dismiss it, but keep it up, so NT8 doesn't shut down. (This part may not be necessary.)
    5. Make a harmless change to the files that build NinjaTrader.Custom.dll in VS2022 in the background.
    6. Hear the noise that indicates NT8 has automatically detected and recompiled the change. (I'm not sure if it's necessary to have the editor window up for this.)
    >> Now you are good to go again.
    Last edited by carnitron; 08-31-2023, 08:11 PM.

    Comment


      #3
      Hello carnitron,

      If that worked to resolve the problem that would be fine. When developing dlls in visual studio it would generally be suggested to use the same approach as the addon visual studio sample in the following link. Each time you compile the dll you will need to restart NinjaTrader to see that change. Most commonly it would be suggested to first exclude your addon using the NinjaScript editor so no code references your dll, exit NinjaTrader, build the DLL and then rer open the platform.

      Comment


        #4
        Hi Jesse. So a couple of questions/comments.

        1. How do I "exclude" my DLL using the NinjaScript Editor? Does that mean using the references dialog to remove the reference to the DLL? If so, I've tried that, and the problem is that if the client code is still making calls to the DLL, the missing imports also prevent NT8 from launching. Theoretically I could somehow remove all references to the DLL also, but that is a lot of work on a big code base and would be a project in and of itself. I.e. I need a lower impact solution. Can you clarify?

        2. If it's not too much trouble can you still answer my original questions, even though I've found a workaround? I.e. Is there a way to compile the solution from:

        A. The command line?
        B. Inside NT8 Safe Mode? No matter what I've tried so far, the compile button stays disabled.

        Thank you,

        Cheers,
        Peter
        Last edited by carnitron; 09-01-2023, 02:40 PM.

        Comment


          #5
          Hello carnitron,

          You would only need to exclude any files that reference that dll when you change it so those items don't have compile errors when the new dll is used. When you have the platform exited and compile the dll again that will replace the dll.

          No if the steps you had used caused an error that prevented the platform from opening and involved removing the custom assembly that would be the way to approach that problem.

          Comment


            #6
            So to be clear, can you confirm that you are saying:

            1. No, there is no way to compile the NT8 custom solution from the command line, in a way that matches NT8 compiling code when it is running.
            2. No, there is no way to compile code in safe mode.

            I've got my workaround, but I'm trying to understand what other tools I might have at my disposal for future issues like this.

            Cheers.

            Comment


              #7
              Hello carnitron,

              NinjaTrader needs to be open and the NinjaScript editor needs to be used to compile. You cannot compile from safe mode.

              Comment


                #8
                Ok thanks for the clarification! Cheers.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                80 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                46 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                29 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                32 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                66 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X