Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Using .NET Assemblies with LabVIEW

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info
Download Help (Windows Only)

An assembly is a unit of deployment similar to a DLL, OCX, or executable for a component in COM. Assemblies are DLLs and executables you build using a .NET compiler. Assemblies can consist of a single file or multiple files. An assembly includes a manifest that contains information about the assembly name, version information, local information, publisher's security information, list of files that make up the assembly, list of dependent assemblies, resources, and exported data types. Single-file assemblies contain all the data in a single file, including the manifest and any resources it needs. Multi-file assemblies might have external resources, such as bitmaps, icons, sound files, and so on, or have one file for the core code and another for helper libraries.

Assemblies can be public or private. Private assemblies are usually located in the same directory as the application directory. Public assemblies are located in a system-wide global cache called the Global Assembly Cache (GAC). The developer of the application typically writes private assemblies for use by that application. The developer of the assembly also decides the version control. The assembly name is the filename, minus any file extension, of the file that contains the manifest.

LabVIEW automatically loads the latest installed version of the .NET Common Language Runtime (CLR). If you develop a .NET application using an earlier version of .NET, it can work on machines with later versions of the CLR. However, if you develop the application with a later version of the CLR than is on the target machine, the application does not work. To work around this issue, you can specify which version of the CLR to use. For example, if you want to build an application using .NET 1.1 and you have both 1.1 and 2.0 on your machine, you can use a configuration file to specify the CLR version.

The .NET CLR uses configuration settings to determine the assembly version to load. These configuration settings might override your request for a specific assembly version. For example, the system administrator can configure your computer to load version 1.0.0.1 instead of 1.0.0.0. If you then try to load version 1.0.0.0, the .NET CLR promotes the assembly version to 1.0.0.1. LabVIEW also notifies you of the promotion.

Referencing Private .NET Assemblies

To create a reference to a private .NET assembly, place a Constructor Node on the block diagram and specify the desired .NET assembly. LabVIEW automatically stores the relative path from the assembly to the VI that contains the .NET object so no manual registration is necessary.

File Management with .NET Assemblies

LabVIEW .config files can apply to a saved project, shared library, or stand-alone application. Refer to Configuring a .NET Client Application for more details about using configuration files with .NET.

If you move a VI that uses a private assembly to a different folder or computer, you must keep the assembly in the same location relative to the VI. If LabVIEW cannot find an assembly file in the GAC, the directory that contains the project, or the relative path stored in the VI, LabVIEW prompts you to find the assembly file.

If you build a VI that uses a private assembly into a shared library or stand-alone application, LabVIEW copies the associated private .NET assembly files to the data subdirectory in the same directory as the library or application.

Loading VIs with an Updated Assembly Path

When you load a VI with a change in the .NET assembly's path, LabVIEW launches a warning dialog box, informing you of the change. Once loaded, the VI includes an asterisk in its title bar and in the list of open VIs displayed in the Window menu. When you save the VI, the asterisk disappears until you make a new change.

When you load a VI with a change in a strong-named assembly's version number or culture string, LabVIEW launches a warning dialog box, informing you of the change. Once loaded, the VI includes an asterisk in its title bar and in the list of open VIs displayed in the Window menu. When you save the VI, the asterisk disappears until you make a new change.

Microsoft Visual Studio .NET and other development tools provided in the .NET Framework SDK can assign strong names to an assembly. Assemblies with the same strong name are expected to be identical.

When you load a VI with a change in the .NET assembly's time stamp, LabVIEW does not launch any warning dialog box. Once loaded, the VI includes an asterisk in its title bar and in the list of open VIs displayed in the Window menu. When you save the VI, the asterisk disappears until you make a new change.


Resources

WAS THIS ARTICLE HELPFUL?

Not Helpful