No announcement yet.

Partner 728x90


Can't Figure Out This Error

  • Filter
  • Time
  • Show
Clear All
new posts

    Can't Figure Out This Error

    Hey everyone. I've been working on both indicators and addon projects using VisualStudio 2019. Been working great for months but now I don't know what I've done, but I can't get anything to compile anymore. Error = CS0579 "Duplicate 'global::System.Runtime.Versioning.TargetFramework Attribute' attribute." NinjaScript File = \NETFramework, Version = v4\5AssemblyAttributes.cs

    I'm really at a loss as to what to do here.

    NinjaTrader 64-bit, Windows10 pro, OS build 18363.1256, MS Visual Studio 2019 version 16.6.4, Microsoft.NETFramework version 4.8.03752

    Any help would be greatly appreciated



    Thanks for your post.

    Another client had this issue and resolved it after installing a clean environment. You could do the same and that would resolve the issue, but I would like to see if we can find out how the compiler is finding the duplicate attribute.

    Try this first

    If you search for "System.Runtime.Versioning" or "AssemblyAttributes" in the Documents\NinjaTrader 8\bin\Custom\ folder, does anything turn up? If so, please move that file out of the bin/Custom folder and then test compiling again. If you have some detail on how those files got there, it will be helpful to note for other clients that may hit this issue.

    Try this second

    If this does not turn anything up, I may then suggest performing a Repair operation with a NinjaTrader installer after you have renamed the Documents\NinjaTrader 8\bin folder to something like "binSAVE." This will create a new bin folder that is clean with only system NinjaScripts added.

    We should not see an issue compiling here, however any 3rd party DLL's would be excluded and we will see compile errors there. You could remove the references from the NinjaScript Editor (Right Click > References) or add the DLL's and associated CS files back in for those DLL's to resolve those errors, but I would suggest testing with the references removed first as a sanity check.

    Once you see that everything compiles, you can bring in the CS files (and DLL's) from your binSAVE\Custom\folder and everything will be back in working order.

    Installers can be downloaded here -

    Related thread:

    If you find the file that has the duplicate attribute added, please report back here.

    We look forward to assisting.
    Marco G.NinjaTrader Customer Service


      Thanks for your help Marco. Sure enough, there was a second "System.Runtime.Versioning" file I found there. Removing it resolved the issue.

      As far as how it got there, there's 2 possibilities:
      1. Around the same time I had downloaded Heiken-Ashi-8. There wasn't an installer or anything like that I just opened the zip file and put the .cs file in the Custom folder along with all the other indicators.
      2. Also around that same time, the active user account on this machine had changed for a bit. Before the change NT8 was running and was connected to a realtime data stream from my broker. This was left running when the active user account changed and later when the active user account came back to where NT8 was running, everything kinda freaked out for a minute or two with both the broker and the NT8. (No response, windows opened/closed on their own, a couple of errors to acknowledge) and then everything seemed to go back to normal.

      I'm leaning towards the former because it was messing around in the same folder but I don't really know for sure.

      Anyway, thanks for your help, I'm back up and running again!



        Hello Marco,

        Definitely recommend the search for "System.Runtime.Versioning" or "AssemblyAttributes" in the Documents\NinjaTrader 8\bin\Custom\ folder and remove anything other than the 4.5 version. I got the duplicate files from doing a build from Visual Studio, which I had just updated. This approach is much better than the clean install as you don't lose your workspaces, etc.



          I use the "Open project in Visual Studio" link to edit my scripts.

          This is how I got the runtime error message:
          1) I installed latest version of NT8 (
          2) When I went to edit one of my indicators, Visual Studio told me to download latest version of .Net Framework as the one I have is older than the one NT has. And so I installed 4.8 (developer pack).

          To resolve the issue, I followed instructions above, then renamed the old one.


          Latest Posts


          Topics Statistics Last Post
          Started by IndieTrader, Today, 05:29 AM
          1 response
          Last Post NinjaTrader_BrandonH  
          Started by ballboy11, Today, 08:09 AM
          1 response
          Last Post NinjaTrader_BrandonH  
          Started by kempotrader, 05-03-2019, 10:52 AM
          8 responses
          Last Post NinjaTrader_ChelseaB  
          Started by waldoalvarez, Today, 07:53 AM
          1 response
          Last Post NinjaTrader_ChrisL  
          Started by sinpeople, 03-05-2021, 09:53 AM
          3 responses
          Last Post NinjaTrader_ThomasC