NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Could not load file or assembly because runtime is newer than currently loaded run time

Go to solution

I have recently upgraded to TestStand 2010 and Visual Studio 2010 from TestStand 4.2.1 and Visual Studio 2008. I am now getting the following error in the sequence analysis for all calls to my .net dlls.

"Module for Step 'My_StepType' not Loadable. Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."


I do not know what runtime it is referring to. It all worked previously. I have tried to browse to the dll again but that doesn't make any difference.


Any ideas?



0 Kudos
Message 1 of 27

Hi, have you opened your VS 2008 project into VS 2010 so that it can perform the conversion by the conversion wizard?



Ray Farmer
0 Kudos
Message 2 of 27

Yes. I have rebuilt all libraries with VS 2010. We did target the .NET 4 framework instead of .NET 3.5 when switching to VS 2010.

0 Kudos
Message 3 of 27

Are you actually see a related error when you run your sequence in the Sequence Editor or UI rather than the analyse tool?

Ray Farmer
0 Kudos
Message 4 of 27



By default the TestStand Sequence Editor targets .NET 2.0 and the .NET adapter can call assemblies built in .NET 2.0-3.5.  This is because those versions of .NET all share the same CLR version.  .NET 4.0 however moved to a new CLR, meaning that if you want to call .NET 4.0 assemblies you will need to make the Sequence Editor target .NET 4.0 as well.  You can do this by creating an app config file for SeqEdit.exe. 


Without going into too many details, just create a file named "SeqEdit.exe.config" and put the following text in it:

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>


Then place this file in the same directory as SeqEdit.exe.  I believe we have an article explaining this in more detail.  I'll try and find it.  Your other option is to target an earlier framework with your .NET assemblies (this is just a project setting in VS 2010).

Message 5 of 27

Also note that my above explanation only applies to the Sequence Editor.  If you are using a UI and you can rebuild it then you can just set your UI to target .NET 4.0 using the project settings in VS 2010.

0 Kudos
Message 6 of 27
Accepted by Skeptical

I found where this topic is discussed in a bit more detail.  It is in the TestStand Reference Manual that gets installed with TS.  In TS 2010 it is on page 5-12 and is the section labeled Using the .NET Framework under the .NET Adapter section of Chapter 5 (Module Adapters).



0 Kudos
Message 7 of 27

Thanks for all the help. Creating the SeqEdit.exe.config file solved the problem. Though, I have to say that as a user it seems like this is something that should have been a configurable option in the station options. From a usability stand point NI fumbled on this one.


I'd be interested in knowing if there are any downsides to having TestStand load .NET CLR 4.0. The reference manual did not give any warnings so it seems like NI expects it to work okay.

0 Kudos
Message 8 of 27

Hi Skeptical,


TestStand 2010 supports using the .NET 4.0 CLR as documented. When using the 4.0 CLR like this, even 2.0 CLR assemblies will be loaded and run in the 4.0 CLR. 2.0 CLR assemblies should work fine in the 4.0 CLR in the vast majority of cases since Microsoft has tried to maintain backwards compatibility as much as possible. Let us know if you run into any issues.


Hope this helps,


0 Kudos
Message 9 of 27

Hi Doug,


It seens that this document


 says calling .NET Framework 4.0 assemblies in TestStand 4.x is not supported. 


TestStand 2010 is 4.x and the article specifically refers to Primary Software Version: 2010 SP1


So it looks like TestStand 2010 does not support .NET 4.0, right?




0 Kudos
Message 10 of 27