Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VS 2022 not loading custom strategy debug file

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

    VS 2022 not loading custom strategy debug file

    I'm running NT 8.1.2.1 and just installed Visual Studio 2022 on this new machine for the first time. I've compiled my custom strategy in Debug Mode and the NinjaTrader.Custom.csproj file has been created. However, I'm getting two errors that are preventing VS from loading the file.

    NU1102 Unable to find package System.ComponentModel.Annotations with version (>= 5.0.0)
    NU1102 Unable to find package Microsoft.CSharp with version (>= 4.7.0)

    I've gone back and installed just about every option available for Visual Studio 2022 that I thought MIGHT resolve these issues.

    It's been a while since I've done any coding/debugging, so I'm having a little trouble resolving this issue. Any assistance would be appreciated!

    #2
    Hello mclaugkc,

    Welcome to the NinjaTrader forums!

    May I confirm you are launching Visual Studio by pressing the Visual Studio button on the toolbar of the NinjaScript Editor?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes, I'm launching VS from within the NinjaScript Editor.

      Comment


        #4
        Hello mclaugkc,

        You are able to compile in the NinjaScript Editor without errors?

        Have you attempted to build or run in Visual Studio?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          The strategy does compile OK in the NinjaScript Editor.

          When I open the .cs file in VS, I see the same errors:

          Click image for larger version

Name:	image.png
Views:	192
Size:	38.8 KB
ID:	1281786

          Comment


            #6
            Hello mclaugkc,

            These assemblies are referenced in the References window if you right-click the NinjaScript Editor.

            This might indicate an issue with the Visual Studio installation.
            You might want to try fully uninstalling Visual Studio and re-installing, and be sure to check the box for .NET C#.

            You might also want to try a clean NinjaTrader environment folder.
            To create a clean temporary NinjaTrader folder:
            1. Shutdown NinjaTrader
            2. Rename (My) Documents\NinjaTrader 8\ to (My) Documents\NinjaTrader 8.original\
            3. Download the NinjaTrader installation package from the link below
            4. NinjaTrader - Download
            5. Run the repair from this (if the repair is unsuccessful, uninstall and then re-install NinjaTrader)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              OK....I uninstalled Visual Studio and reinstalled with the .NET C# option
              Re-compiled the code in Debug Mode and opened VS (from within NT). Still saw the same errors.
              Renamed my documents folder to "NinjaTrader 8.original" and ran 'Repair' from the newly downloaded install file.
              Re-compiled and opened VS. Still had the same errors.
              Uninstalled NT, rebooted my machine, and installed NT from scratch from the latest install file.
              Pulled the strategy code back over from the "NinjaTrader 8.original" Strategies folder, re-compiled in Debug Mode and opened VS. STILL seeing the same results
              Click image for larger version

Name:	image.png
Views:	208
Size:	27.6 KB
ID:	1281797
              I do see the System.ComponentModel.DataAnnotations.dll file in the References. Is this the parent file for System.ComponentModel.Annotations - which is the missing file I'm seeing in the errors?
              I also see the Microsoft.CSharp.dll file in References.

              I really wasn't expecting this much difficulty in setting this up. I used to do debugging on my laptop several years ago without any issues.

              Comment


                #8
                Hello mclaugkc,

                Yes, the System.ComponentModel would have the DataAnnotations.

                I'm uncertain of what would be causing the errors if NinjaTrader is referencing the assemblies.

                I am also unable to reproduce on my end, which still suggests an issue with Visual Studio on your machine.

                Do you have another machine you can test with temporarily?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I went digging for Visual Studio results for this type of error and came across this site:
                  I am not a developer but I am hoping to test an application provided by Microsoft. https://learn.microsoft.com/en-us/azure/active-directory-b2c/configure-authentication-sample-web-app?tabs=visual-studio I have downloaded what is needed. After the…


                  After reloading VS (from NT), the 2 errors are now gone. Assuming I can load the cs file from the Solution Explorer in VS, I might be able to debug.​

                  Comment


                    #10
                    I have the same errors but no issues with compiling my custom strategies/indicators

                    Click image for larger version

Name:	image.png
Views:	194
Size:	9.7 KB
ID:	1281826

                    Comment


                      #11
                      Hello mclaugkc,

                      May I have you clarify the steps you took?

                      "After reloading VS (from NT)"

                      By this do you mean you closed Visual Studio and relaunched by clicking the Visual Studio button on the NinjaScript Editor toolbar?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Yes, that's exactly what I did. I'm hoping to actually begin debugging today.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by NullPointStrategies, Yesterday, 05:17 AM
                        0 responses
                        55 views
                        0 likes
                        Last Post NullPointStrategies  
                        Started by argusthome, 03-08-2026, 10:06 AM
                        0 responses
                        132 views
                        0 likes
                        Last Post argusthome  
                        Started by NabilKhattabi, 03-06-2026, 11:18 AM
                        0 responses
                        73 views
                        0 likes
                        Last Post NabilKhattabi  
                        Started by Deep42, 03-06-2026, 12:28 AM
                        0 responses
                        45 views
                        0 likes
                        Last Post Deep42
                        by Deep42
                         
                        Started by TheRealMorford, 03-05-2026, 06:15 PM
                        0 responses
                        49 views
                        0 likes
                        Last Post TheRealMorford  
                        Working...
                        X