• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Export fails for indicators that have referenced .dlls

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

    Export fails for indicators that have referenced .dlls

    Hi -

    I have a bare bones indicator that references a simple .dll that was developed with .Net Framework 4.5. When I add the reference and compile the indicator it works just fine.

    When I try to export the indicator, I get the following error:

    Error compiling export assembly: c:\Users\Owner\Documents\NinjaTrader 8\bin\Custom\Indicators\FWTestIndicator.cs(47,13) : error CS0103: The name 'FWHelper' does not exist in the current context

    I have tried this with several indicator and several .dll, all to get the same error.

    Please advise on how to fix this.

    Find the test indicator file, the source code for the .dll, and the .dll itself within the attached 'Export Problem.zip' file Export Problem.zip

    Thanks for your help.

    #2
    Hello kweiss,

    Thank you for providing the sample that helps to see the problem.

    In this case you would get this error if you are not selected the reference during the export, are you also selecting the reference when you go to export the file?

    There is a dropdown list of items that can be exported which includes "References". When you export with a dll reference you will need to do this, it also warns you that you need to manually modify the zip afterwards to add the file. You can find the steps for that here: https://ninjatrader.com/support/help...esOrNativeDlls


    I would also suggest using the fully qualified name when calling any referenced code. When working with compiled exports it is best not to rely on using statements, I see that you have used the indicators namespace so that will work however for other libraries or items not in a NinjaScript namespace I always suggest using the following format:

    Code:
    DateTime x = NinjaTrader.NinjaScript.Indicators.FWHelper.GetDate();

    You may also have an interest in the addon sample we provide for visual studio, it has a build action which copies the resulting DLL to the user data folder. This can be helpful if you have many changes to make, you can automate copying the file at least. This still requires you to exit the platform before the copy and restart to see changes.
    https://ninjatrader.com/support/help...t_overview.htm (AddOn Development Environment (Visual Studio Advanced))

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer. It has helped me to export my indicator, however, that indicator will not import properly. Now I am getting the following error when I try import the indicator:

      Failed to restore Indicator 'NinjaTrader.NinjaScript.Indicators.TradeSafe.Indi cators.TradeSafeTrend'. Most likely (a) the implementation changed or (b) one or more properties have been renamed or removed or (c) the custom assembly which implements this Indicator no longer is there.

      Find attached a bare-bones test project and the Ninja test indicator.

      Please advise on how to import this.

      Thank you.
      Attached Files

      Comment


        #4
        Hello kweiss,

        One problem I can see is that you have selected .NET Standard projects, you would need to make a .NET framework project to be compatible. If you are using VS 2019 that would be under C# -> Windows -> Library -> Class Library (.NET Framework). It would need to be .NET Framework 4.5 or less.

        Please try to delete the existing library you have and recreate/re export under .net framework and try again. If that fails again please provide the updated project as you did before.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank you for your suggestion. While it fixed the previous problem, I still can not import the indicator. I am now getting the following errors:
          Error compiling import assembly: error CS0006: Metadata file 'F45.Main' could not be found
          Error compiling import assembly: error CS0006: Metadata file 'F45.Common' could not be found
          I have attached the exported Add-on, the original indicator and the .Net project the created F45.Main and F45.Common.

          Thank you for all your help.
          Attached Files

          Comment


            #6
            Hello kweiss,

            Have you completed the steps from the help guide here:
            https://ninjatrader.com/support/help...esOrNativeDlls

            After you export as a compiled assembly you get a zip with a .txt file in it, that only explains what references it needs. For your development PC as long as you have the references in NinjaTrader you could import this to test it. On any other PC or if you remove the references it will not import unless you complete the manual addition of the .DLLs to the .ZIP like described in the help guide. This allows the import to copy/reference the dlls.

            I was able to see this export/import successfully on my end.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hi -

              I am a bit confused. Please look at the uploaded FW45Test.Zip. You will see the two .dlls have been manually added as explained in the help text. Please upload indicator zip so I can see exactly how it is setup.


              Thank you.

              Comment


                #8
                Hello kweiss,

                Did you manually make the AdditionalReferences.txt or did you export the references using the export menu?

                I made no changes to the files you provided, just re exported using the export window and that file was able to import successfully. I also removed the references before the import and it was able to import the references in the zip. You would need to select both references in the export and then your AdditionalReferences file should look like the following once generated:

                *MyDocuments*\NinjaTrader 8\bin\Custom\F45.Main.dll
                *MyDocuments*\NinjaTrader 8\bin\Custom\F45.Common.dll


                If you are still having trouble please list the specific steps you used through the export process.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Gorkhaan, Today, 02:55 AM
                0 responses
                4 views
                0 likes
                Last Post Gorkhaan  
                Started by mbell.irves, Today, 12:36 AM
                0 responses
                11 views
                0 likes
                Last Post mbell.irves  
                Started by cutzpr, Yesterday, 09:18 PM
                0 responses
                7 views
                0 likes
                Last Post cutzpr
                by cutzpr
                 
                Started by CoffeeOutlaw, Yesterday, 05:59 PM
                3 responses
                22 views
                0 likes
                Last Post CoffeeOutlaw  
                Started by Da vinci, Yesterday, 04:19 PM
                2 responses
                15 views
                0 likes
                Last Post Da vinci  
                Working...
                X