Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

64 bit PresentationCore.dll in NinjaTrader.Custom.csproj

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

    64 bit PresentationCore.dll in NinjaTrader.Custom.csproj

    Is there a way to reference the 64-bit PresentationCore.dll in the NinjaTrader.Custom.csproj file?

    Whenever I build my project, I get this warning:

    1>------ Build started: Project: NinjaTrader.Custom, Configuration: Debug x64 ------
    1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Mi crosoft.Common.CurrentVersion.targets(2413,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "PresentationCore", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

    This warning goes away if I change these project file lines:

    <Reference Include="PresentationCore">
    <HintPath>C:\Windows\Microsoft.NET\Framework\v4. 0. 30319\WPF\PresentationCore.dll</HintPath>
    </Reference>

    to these lines:

    <Reference Include="PresentationCore">
    <HintPath>C:\Windows\Microsoft.NET\Framework64\v 4. 0.30319\WPF\PresentationCore.dll</HintPath>
    </Reference>

    which point to the Framework64 directory rather than the Framework directory.

    However, whenever I run NinjaTrader, the Framework64 version gets replaced with the Framework version in the .csproj file that NT8 emits.

    Moreover, this happens even if I make the reference change to the Framework64 version in Config.xml!

    Is there any way around this? It's not lethal, my project still runs with the Framework version even though everything is built in x64.

    Still, it would be nice to make the error go away.

    #2
    -- Delete this --

    This post was meant for the NinjaTraderD Desktop / Platform Technical Support forum. Apologies for the confusion!
    Last edited by carnitron; 01-15-2025, 09:58 PM.

    Comment


      #3
      Hello carnitron,

      Just to confirm, you are not attempting to build the NinjaTrader project from Visual Studio correct? (You cannot build the NinjaTrader project)

      You have your own custom project and you are trying to reference the NinjaTrader.Core.dll from your custom project, is this correct?

      Below is a link to 'Visual Studio Solution for AddOn Development' which you can use as a starting point and has everything referenced correctly.

      Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I AM trying to build the NinjaTrader project from Visual Studio. This works and is a great way to rapidly iterate, b/c you can make sure your code compiles without going through the whole NT8 launch and build cycle.

        I use the NT8 generated custom project and then I have two DLL projects that I build that my NT8 project talks to, though these are not relevant to the discussion.

        Thanks for that example. It is interesting b/c everything is configured for "Any CPU", whereas I am building everything for x64.

        Is building x64 not actually what I should be doing? My initial rationale for doing this was to get native x64 speed, but for the moment, perf is not a serious issue for me, so maybe that assumption can go.

        Comment


          #5
          Hello carnitron,

          NinjaTrader does not support building or compiling the NinjaTrader project.

          You can create your own projects and reference NinjaTrader.Core.dll and build those in Visual Studio.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Boy, I would love to get away from the NinjaTrader project if I could.

            But I want to make sure we are talking about the same thing here.

            I have two DLL projects that each reference NinjaTrader.Core.dll and build inside of Visual Studio as you suggest.

            I have a third project, however, that contains my AddOn, a number of Indicators, and a Market Analyzer Column, all of which talk to my DLLs. I have been doing all this inside of the NinjaTrader project itself b/c I thought this is how we were supposed to do it, and I'm not sure how else to go about it.

            Is there a way to create an Indicator in its own DLL project? Can this be done with AddOns and Market Analyzer Columns as well?
            Last edited by carnitron; 01-16-2025, 01:27 PM.

            Comment


              #7
              Hello carnitron,

              The 'Visual Studio Solution for AddOn Development' sample project is demonstration of how to build addons, indicators, and other scripts in a custom external project that has a reference to the NinjaTrader.Core.dll.

              The NinjaTrader project is the project that opens with the VisualStudio button in the NinjaScript Editor, with the file located in Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Custom.cproj.

              With open source scripts that are compiled into NinjaTrader, this is done automatically by the NinjaScript Editor.
              If you leave the NinjaScript Editor open and save a script in Visual Studio or an external editor, the NinjaScript Editor will automatically detect the changes and automatically trigger a compile.

              You will not be able to build the project from Visual Studio. Attempting to do so will cause compile errors and will break the installation.
              Forum thread where this is discussed:
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Holy crap.

                Ok, I will investigate. This might be a serious quality of life improvement. Thank you for that.

                FWIW, I have been building the NinjaTrader.Custom.cproj in Visual Studio while NT8 is running as well as when it isn't. To be clear, it DOES work, and well enough to do development this way, as I have now for several years.

                Though it is certainly not without its annoyances, including constantly having to modify Config.xml, hand modifying NinjaTrader.exe.config every time I upgrade NinjaTrader, dealing with .csproj issues around the margins, etc.

                Anyhow, let me try putting my stuff into this new project format. Thanks again.

                Comment


                  #9
                  Ok, I migrated my code out to a separate AddOn Solution and it is wonderful. A lot less fiddling and constraint than the old one. Thank you a ton for the help there, Chelsea.

                  . . .

                  I do want to make a few suggestions and convey my experience here, though, for the benefit of future customers who might go down the same path I did.

                  1. The AddOn example does NOT include indicators and MarketAnalyzerColumns. Having one of each included in that AddOn example would be super helpful, ofc.

                  2. I actually looked at the AddOn example you provide here a long time ago, and concluded that the main point was to show customers how to do a custom window. I wasn't even clear that the AddOn solution was intended to run standalone, b/c there are no comments or doc that I am aware of that explain how to do it or that it is even possible. So I copied the contents into the NinjaTrader.Custom.csproj and went from there.

                  3. After looking at the Indicators in the NinjaTrader.Custom.csproj, and then a simple test Indicator I added there, I noticed that the NT8 project build process autogenerated shim code at the bottom of the Indicator (and MarketAnalyzerColumn) files. This code seemed important and necessary somehow, so I felt doubly sure this was the place to put my code. In fact, I actually copied this shim code out to my standalone migration project here initially, only to accidentally discover that it wasn't necessary!

                  The point here is that a few high-visibility comments and explanations in the online doc and AddOn example itself might be very helpful in steering new people in the right direction.

                  All of what I've covered here might seem obvious to people who have worked with NT8 for a long time, but when you are a new user and are looking to minimize complexity and unknowns, you try to look at just what is in front of you, that you know works, rather than experimenting and trying random things to see what *might* work. It's only after working with a product or dev environment for a while, that one gains the confidence and understanding to draw new conclusions about what might reasonably expected to work.

                  Regardless, thanks again for the help, I now have a significantly smoother experience.

                  Cheers.

                  Comment


                    #10
                    Oh, actually, one other question.

                    So the AddOn example you provided builds everything as AnyCPU. But I notice that the NinjaTrader.Core.dll and NinjaTrader.Core.dll seem to be built 64-bit.

                    So if I build my projects as AnyCPU, I get the following warning:

                    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Mi crosoft.Common.CurrentVersion.targets(2413,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "NinjaTrader.Core", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

                    If I build my code 64-bit, these warnings go away.

                    What is the guidance here: build everything 64-bit? Or there any tradeoffs between 64-bit and AnyCPU I should be aware of? Otherwise, it seems like 64-bit is the way to go, to make the warnings go away.

                    Comment


                      #11
                      Hello carnitron,

                      Thank you for the suggestions. This will be considered.

                      NinjaTrader 8 is now 64-bit only and there is no longer a 32-bit version. As NinjaTrader targets this architecture so do the dlls and your project as well.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      556 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      324 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
                      545 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