NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET API : Error when using TestStand.Utility

Hello everyone,

 

Alright so I'm kind of new to .NET, not to say completely new, so bear with me =). First, quick context presentation : we're trying to develop a tool which will help us dynamically launch certain sequences depending on a few input parameters (configurations, sequence list files...). We decided to go for a python script. This script will use a set of functions located in a .DLL integrating the teststand's API. We're unsure if this the best or even a good idea, so if you have something simpler (which is also easily maintainable)  I'm all ears. 

 

Unfortunately, I've encountered a problem using Teststand's .NET API with the NationalInstruments.TestStand.Utility library. 

 

Every time I try to use a function located in this file I get the following error at runtime only (sorry it's in French) : 

 

 

  File "C:\Users\nharel\Dev\l050_testsdkthermique\Env\SDK_RunAutotest.py", line 26, in <module>
    obj.Main()
System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'NationalInstruments.TestStand.Utility, Version=20.0.0.49180, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable.
Nom de fichier : 'NationalInstruments.TestStand.Utility, Version=20.0.0.49180, Culture=neutral, PublicKeyToken=null'
   à ApiTeststand.TestStandSequenceCalls.Main()

 


It's telling me that it either can't find the NationalInstruments.TestStand.Utility lib or a dependency. Now this is the "reference include" in the .csproj (I'm using VS Code + msbuild) : 

 

 

    <Reference Include="NationalInstruments.TestStand.Utility">
      <Name>NationalInstruments.TestStand.Utility</Name>
      <HintPath>C:\Program Files\National Instruments\TestStand 2020\API\DotNET\Assemblies\CurrentVersion\NationalInstruments.TestStand.Utility.dll</HintPath>
    </Reference>

 

Now I checked, and the path is correct, and there's a Utility.dll in that folder (I used the splashcreen C# user interface as an example). I don't understand what I'm doing wrong. Maybe it's got something to do with the framework we're using, it's the 4.6.2 version ? The The Buildtools used are the last one available for VS 2019 (16.10).  Anyone's got an idea ? We would greatly appreciated, I spent way too much time on this already. Thank you ! 

The utility function called, even though I don't think there's anything wrong here : 

 

    public static void Main()
    {
        // Create application domain, call MainEntryPoint, and
        // cleanup before return.
        LaunchTestStandApplicationInNewDomain.LaunchProtected(
           new LaunchTestStandApplicationInNewDomain.MainEntryPointDelegate(MainEntryPoint),
           "App",
           new LaunchTestStandApplicationInNewDomain.DisplayErrorMessageDelegate(DisplayErrorMessage));
    }

    // Main entry point executed in new application domain.
     private static void MainEntryPoint()
     {
     }

     private static void DisplayErrorMessage(string caption, string message)
     {
         System.Console.WriteLine("Error: " + caption + "\n" + message);
     }

 

 

 

0 Kudos
Message 1 of 2
(586 Views)

Never mind, I got around this by using python directly, the win32com module, and by not using the utility lib. 

0 Kudos
Message 2 of 2
(581 Views)