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

Reference external libs from NinjaTrader.Custom

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

    Reference external libs from NinjaTrader.Custom

    In my lib csproj I edit and used

    Code:
    <PropertyGroup>
        <PostBuildEvent>xcopy /E /Y "$(TargetFileName)" "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\NinjaTrader 8\bin\Custom"
    xcopy /E /Y "$(TargetName).pdb" "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\NinjaTrader 8\bin\Custom"</PostBuildEvent>
      </PropertyGroup>
    I can see the external lib in Documents\NinjaTrader 8\bin\Custom folder together with other addons and NinjaTrade.Custom.dl. However NT cannot find it the assembly

    #2
    from further investigation I can tell that when I compile through NinjaScript editor the external libs reference in NinjaTrader.Custom.csproj file are removed? Can I somehow tell NT not to replace that file?

    Comment


      #3
      Hello,

      Thank you for the post.

      Could you provide more detail on what you are specifically trying that is not being found? I am unsure by what has been provided what the exact problem is currently.

      It sounds like you have used the Build Events from the example Visual Studio solution here?

      Is there an error with some code you are trying when NinjaTrader compiles? Could you provide an image or more detail on the specific problem?



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

      Comment


        #4
        there was a problem with nugets but I solve it however the major problem is that
        every time you recompile from the Compile button in NinjaScript editor the external lib references are removed from NinjaTrader.Custom.csproj so it cannot compile

        Comment


          #5
          Hello,

          Yes this would be expected the custom project is regenerated when you compile. You would need to use an external visual studio project if you want to use nuget or other more advanced solution options.

          We have an example of creating a NinjaScript DLL in a separate project here: http://ninjatrader.com/support/helpG...t_overview.htm

          the "AddOn Development Environment (Visual Studio Advanced)" contains a download for a whole solution which also contains the build event to copy the DLL. This solution file would be unchanged by compiling NinjaTrader because it is in a separate folder/solution. You should not directly edit the NinjaTrader.Custom.csproj file as this is used internally specifically.

          This would reference the core files needed when creating NinjaScript items, you are free to add other references but keep in mind any references you add will also need to be added using the NinjaScript editor -> Right Click -> References menu.

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

          Comment


            #6
            where does NinjaScript Editor stores the references for the project? Can I add more somehow without using the Add Reference Script Editor menu?

            Comment


              #7
              Hello,

              These are stored in the Config file, but editing this file outside of the platform is advised against. The only supported/suggested way to add references is manually using the Editor.

              For development, you can just add the references manually once and then you don't have to do anything further.

              Once you export a NinjaScript assembly for other users to import, you can use the AdditionalReferences.txt file to include your assemblies in the final importable zip. When exporting you can select the other references to include and follow the instructions in the help guide to create a zip file with all resources in it.



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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cre8able, Today, 03:20 PM
              1 response
              9 views
              0 likes
              Last Post cre8able  
              Started by fiddich, Today, 05:25 PM
              0 responses
              3 views
              0 likes
              Last Post fiddich
              by fiddich
               
              Started by gemify, 11-11-2022, 11:52 AM
              6 responses
              804 views
              2 likes
              Last Post ultls
              by ultls
               
              Started by ScottWalsh, Today, 04:52 PM
              0 responses
              4 views
              0 likes
              Last Post ScottWalsh  
              Started by ScottWalsh, Today, 04:29 PM
              0 responses
              7 views
              0 likes
              Last Post ScottWalsh  
              Working...
              X