In C#, you can access TSM APIs by adding the corresponding component as a reference in a project.

API Component
TSM Code Module API NationalInstruments.TestStand.SemiconductorModule.CodeModuleAPI
TSM Application API NationalInstruments.TestStand.SemiconductorModule.ApplicationAPI

TSM installs .NET assemblies for the TSM Code Module and Application APIs in the <TestStand>\API\DotNet\Assemblies\CurrentVersion directory and in the Global Assembly Cache (GAC). The assemblies support .NET 4.0 and later.

To add a reference to TSM API assemblies in Visual Studio, select the project in the Solution Explorer and select Project » Add Reference. If the assemblies do not appear in the corresponding dialog box, exit all running copies of Visual Studio, launch the TestStand Version Selector, select the current version of TestStand, and click the Make Active button.

Note If you have both 32-bit and 64-bit TestStand installed but only 32-bit TSM installed, TSM API assemblies do not appear in the Add References dialog box. Click the Browse tab and select the assembly from the <TestStand>\API\DotNet\Assemblies\CurrentVersion directory.

After you add one of the TSM API components as a reference in a project, add the following directive at the top of the source file:

using NationalInstruments.TestStand.SemiconductorModule;

or

using NationalInstruments.TestStand.SemiconductorModule.CodeModuleAPI;

All TSM classes, methods, and properties are available in the Microsoft Visual Studio object browser and are accessible from the C# source code. Help text for classes, methods, and properties appears in Microsoft IntelliSense.

To control NI instruments from a .NET assembly, you must also complete the following tasks:

  • Install the appropriate NI driver for the instrument you want to control. Ensure you install the correct NI .NET API for the version of the NI driver you installed. For some NI drivers, you must manually select .NET support options in the installer.
  • Add a reference to the corresponding NI driver .NET API assembly to the project. The Accelerometer with .NET and the Part Average Testing with .NET examples include Visual Studio projects that reference the TSM Code Module API and some NI .NET APIs and demonstrate how to invoke those APIs.

Visit ni.com/info and enter the Info Code NETAPIdriversupport for information about the available NI .NET APIs and the versions of the NI drivers each supports.

Upgrading TSM

(TSM 2019 or later) When you upgrade to TSM 2019 or later, you do not need to update .NET assembly references to the TSM Application API or TSM Code Module API assemblies in Visual Studio projects. The TSM installer ensures that references to earlier versions of the API assemblies are automatically redirected to the current version of the assembly.

(TSM 2017 or earlier) When you upgrade to a full, non-service pack version of TSM and you want to continue to use existing code modules and applications in the later version, you must update the .NET assembly references in Visual Studio projects. The assemblies you build using TSM APIs are compatible only with the version of TSM, including service packs, you reference in Visual Studio projects.

Upgrading Instrument Drivers

When you upgrade to a later version of an instrument driver .NET API, you do not need to update the .NET assembly references in Visual Studio projects. NI instrument driver .NET API installers ensure that references to earlier versions of the instrument driver .NET API assembly are automatically redirected to the current version of the assembly if the earlier version assembly does not exist.

The following table lists the minimum version of instrument driver .NET APIs TSM supports.

NI Driver Assembly Name Minimum Version
NI-DAQmx NationalInstruments.DAQmx.dll 16.1
NI-DCPower NationalInstruments.ModularInstruments.NIDCPower.Fx40.dll 1.1
NI-Digital Pattern NationalInstruments.ModularInstruments.NIDigital.Fx40.dll 16.0
NI-DMM NationalInstruments.ModularInstruments.NIDmm.Fx40.dll 15.2
NI-FGEN NationalInstruments.ModularInstruments.NIFgen.Fx40.dll 16.0
NI-RFmx NationalInstruments.RFmx.InstrMX.Fx40.dll 19.0
NI-RFPM NationalInstruments.ModularInstruments.NIRfpm.Fx40.dll 14.5
NI-RFSA NationalInstruments.ModularInstruments.NIRfsa.Fx40.dll 19.0
NI-RFSG NationalInstruments.ModularInstruments.NIRfsg.Fx40.dll 19.0
NI-SCOPE NationalInstruments.ModularInstruments.NIScope.Fx40.dll 2.0
NI-SWITCH NationalInstruments.ModularInstruments.NISwitch.Fx40.dll 1.1