Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assembly could not be exported.

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

    Assembly could not be exported.

    I am trying to export my strategy as assembly.
    • I have selected/included all the references it utilizes.
    • References include 3 custom indicators I have developed and exported as assemblies, excluded from compilation and then imported and confirmed they work fine on my charts.
    • But when I try to export my strategy as assembly, I get error "Assembly could not be exported. Please ensure all required components are included." but I have selected all of the references to be included...
    • My strategy exports just fine if I'm using the ninjascript editor versions of my indicators (not imported ninjascript assembly versions). It's only a problem when I try to export my strategy when the indicators are the assembly versions.
    • My custom indicators only reference a single system indicator internally (ATR in both cases). I have tried including ATR with my strategy export. Does not fix the error.
    NT support, is there no way to get more specifics on this error? Nothing is logged in Log tab. Nothing added to log or trace files either when the export fails with this error.

    I've been at this 6 hours straight and cannot figure it out because there's zero information provided.
    Last edited by iantriestrading; 11-17-2024, 11:29 PM.

    #2
    Hello iantriestrading,

    Besides making sure to manually include all resources including system indicators this would be situation where you may need to debug the code to find the answer. If including the used resources does not work you would have to comment out your code and try to export it until it works. At that point you would see whatever the last commented out code was to learn what is holding up the export. Based on that observation the resolution will change based on what code cant export.

    Comment


      #3
      Hi Jesse,

      Any idea why no specific error is provided in logs? Is that just how NT is designed, or is it due to how class library compilation works in general?

      Comment


        #4
        Hello iantriestrading,

        If no specific error is provided that means there was no information that could be logged for that. In some specific cases you may see a specific compile errors listed, in other cases it may not be known what the specific problem is and could be related to some code being used. An example would be using enums, that requires using the fully qualified name to the type wherever the enum is used in code rather than using a using statement at the top of the script to point to the enums namespace.

        Comment


          #5
          Do I have to use fully qualified names for everything?

          For example, do I have to create properties like this?

          Code:
          [NinjaTrader.Gui.NinjaScriptProperty]
          [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)]
          [System.ComponentModel.DisplayAttribute(Name = "Period 1", GroupName = "Parameters", Order = 1)]
          public int Period1 { get; set; }
          Are there any other gotchas like the enums you mentioned? Thanks Jesse!
          Last edited by iantriestrading; 11-18-2024, 10:37 AM.

          Comment


            #6
            The only item that really comes up would be using enums and namespaces. namespaces in general need to specified before the type when you're exporting as an assembly. if you have used custom classes or other custom types that you need in your code you will have to use the full name space before the type instead of using statements at the top of the script.

            Comment


              #7
              So I don't need to change my properties to be like this? I just want to be sure I'm not missing anything here.

              Code:
              [NinjaTrader.Gui.NinjaScriptProperty]
              [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)]
              [System.ComponentModel.DisplayAttribute(Name = "Period 1", GroupName = "Parameters", Order = 1)]
              public int Period1 { get; set; }
              I am still trying to get this to work. I have created a minimal test strategy that utilizes my custom indicator. Same situation. "Assembly could not be exported. Please ensure all required components are included." with no errors logged.

              At this point I'm at 20 hours trying to debug this with zero information to go on. I have followed all of your instructions with no luck.

              Comment


                #8
                Hello iantriestrading,

                No that would only be for custom types or some items like Drawing tools may need to be changed to using a dynamic type. You really just need to use the comment method here as that will be the fastest way to find the problem and should only take a couple minutes. You can comment out all of your custom code leaving just the base type, export and make sure it works. Then uncomment the public properties, repeat exporting and make sure it works. Once you reach the part of your code that's causing a problem we can look at what types you have used and figure out which part is the problem.

                Comment


                  #9
                  Thanks for your specifics on the comment method. I wasn't sure exactly how to go about it. I'll try this now.

                  Comment


                    #10
                    Jesse, I tried the comment-out method and got nowhere, unfortunately.

                    I even tried creating a super minimal test strategy and test indicator, and I still cannot export the strategy when the indicator is the imported assembly version. I still get "Assembly could not be exported. Please ensure all required components are included."

                    I've attached the test strategy and test indicator source. To replicate my steps, please export the indicator as assembly and then import it. Then try to export the strategy with that indicator as reference.
                    Attached Files

                    Comment


                      #11
                      Hello iantriestrading,

                      You mentioned as the imported assembly version, are you adding the Reference for that indicators assembly from the drop-down list when doing the export?

                      Comment


                        #12
                        Hi Jesse,

                        Yes, I am adding the reference for the indicator's assembly when doing the export.

                        Comment


                          #13
                          Hello iantriestrading,

                          The files you provided are missing the default using statements, your scripts should always have all of the using statements that you see in other indicators like the ADL or SampleMACrossover strategy. If you fix the using statements do you still see a problem?

                          Comment


                            #14

                            Jesse,

                            For one of my indicators, that was it!!! I did not realize I had missing using statements since my indicator compiled with no errors, and worked fine as both ninjascript and assembly, except for when it was used in an exported strategy.

                            Thank you!

                            Comment


                              #15
                              Jesse,

                              I'm still battling this issue with one last indicator that has some custom public enums and a public class.
                              It doesn't appear to be missing any using statements.

                              I moved those custom enums and class into their own namespace namespace MyCompany.MyIndicator {}

                              And in the indicator's main class I reference them like MyCompany.MyIndicator.MyEnum for example.

                              When I try to export a very simple strategy that utilizes my indicator, I get that same error, "Assembly could not be exported. Please ensure all required components are included."

                              Is it wrong to have my custom public enums and a custom public class in their own namespace? Documentation seems to say that's what I must do
                              Last edited by iantriestrading; 11-18-2024, 03:45 PM.

                              Comment

                              Latest Posts

                              Collapse

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