Measurement Studio .NET Class Library Versioning for Development and Deployment

Measurement Studio 2015 Support for Visual Studio 2013 Help

Edition Date: May 2015

Part Number: 375857A-01

»View Product Info
Download Help (Windows Only)
This topic documents what the Measurement Studio .NET class library version numbers mean and describes how .NET applications that are built with different versions of Measurement Studio and installed on the same machine resolve their references and use a particular version of a class library.

For information pertaining to a machine with a Measurement Studio development system installed, refer to .NET Class Library Versioning for Development. For information pertaining to deploying applications that use Measurement Studio libraries, refer to .NET Class Library Versioning for Deployment.

Measurement Studio Year-Based and Major.Minor Version Equivalents

Versions of Measurement Studio that follow year-based versioning continue to use major.minor versioning for registry keys, folder names in some directories, and other miscellaneous features. For example, the major.minor version equivalent for Measurement Studio 2012 support for Visual Studio 2008 is 12.0, and the version of the NationalInstruments.UI.WindowsForms.NET assembly in Measurement Studio 2012 support for Visual Studio 2008 is 12.0.35.318. Refer to Measurement Studio Year-Based and Major.Minor Version Equivalents for more information.

.NET Class Library Version Numbers and Strong Names

Measurement Studio .NET class library version numbers use the format <major version>.<minor version>.<framework version>.<build number>, where:

Measurement Studio .NET class libraries are strong-named so that the .NET Common Language Runtime versioning policies are enforced and so that Measurement Studio libraries that support one version of Visual Studio do not interfere with the libraries that support another version of Visual Studio. To achieve this second objective, the strong names can be different for the same assembly with different <framework version> version numbers. For example, NationalInstruments.WindowsForms version 8.5.20.x and NationalInstruments.WindowsForms version 8.5.35.x have different strong names and different public key tokens. Refer to the .NET Framework documentation for more information on strong names and public key tokens.

.NET Class Library Versioning for Development

When you install Measurement Studio development support, .NET class library assemblies are installed to the Global Assembly Cache (GAC) as well as to the DotNET\Assemblies\Current subdirectory of the Measurement Studio directory. When you reference a Measurement Studio assembly from a Microsoft Visual Studio project, you reference the copy that is in the subdirectory of the Measurement Studio directory. When you run the application that is built with the project, the application uses the copy of the Measurement Studio assembly that is located in the GAC. This is a standard approach for using .NET class libraries with Visual Studio.

The result of this approach is that, typically, your application loads the exact version of each Measurement Studio assembly that it was compiled against, even if you subsequently install a later version of Measurement Studio or if you install a third-party application that installs later versions of the Measurement Studio assemblies. If you install a later version of Measurement Studio and then rebuild your application, your application references the later version of the Measurement Studio assembly and, consequently, loads it at run time. The benefit of this approach is that application behavior remains constant regardless of what is subsequently installed on the system. The downside to this approach is that you must rebuild your application or use an application configuration file to take advantage of later versions of Measurement Studio assemblies, which might include necessary bug fixes. Refer to Redirecting Assembly Versions in the Microsoft .NET Framework documentation for more information about application configuration files.

This design requires that the Measurement Studio development system uninstaller leave the assemblies in the GAC so that when you install a later version of Measurement Studio, applications that were built against the prior version of Measurement Studio continue to load the versions of the assemblies that the applications were built against. To completely remove Measurement Studio assemblies from a machine on which you installed a Measurement Studio development system, you must manually remove the Measurement Studio assemblies from the GAC. This does not apply to machines to which you have deployed applications that reference Measurement Studio assemblies, but do not have Measurement Studio development systems installed.

Common .NET Class Library Versioning for Development

NationalInstruments.Common.dll uses a publisher policy file to redirect applications to always use the newest version of NationalInstruments.Common.dll installed on the system, for each version of the .NET Framework. However, prior versions of NationalInstruments.Common.dll remain in the GAC after you install a newer version of Measurement Studio. NationalInstruments.Common.dll is backward-compatible to ensure that all applications built against prior versions of Measurement Studio continue to work as expected.

Note:
Measurement Studio support for Visual Studio 2013, Visual Studio 2012 and Visual Studio 2010 uses the same NationalInstruments.Common.dll assembly, which is built against the .NET Framework version 4.0.

When you rebuild a Measurement Studio project that references NationalInstruments.Common.dll, you might receive the following warning: MSB3247: Found conflicts between different versions of the same dependent assembly

You might receive this warning for one of the following reasons:

You can safely disregard this warning because NationalInstruments.Common.dll uses a publisher policy file to redirect references from older versions to newer versions. However, if you double-click this warning in the Visual Studio Error List, you receive a prompt to generate a binding redirect for NationalInstruments.Common.dll in your app.config file. If you generate a binding redirect, the warning is no longer generated when you build the project. However, if you subsequently update NationalInstruments.Common.dll on the machine, building the referencing project results in a build error. To fix the build error, you must update the binding redirect entry in your app.config file.

Versioning for Development with Class Libraries that Depend on Unmanaged Code

Some Measurement Studio .NET class libraries provide interfaces to COM servers or shared DLLs. The .NET DataSocket and Analysis class libraries are examples of class libraries that provide interfaces to COM servers or shared DLLs. Refer to Measurement Studio COM Servers and Shared DLL Versioning and Deployment for information on the versioning implications of COM servers and shared DLLs.

Measurement Studio .NET Class Library Versioning for Deployment

When you install Measurement Studio development support, merge modules that you use to deploy the Measurement Studio .NET class library assemblies are installed to Program Files\Common Files\Merge Modules on a 32-bit machine or to Program Files (x86)\Common Files\Merge Modules on a 64-bit machine. When you use Visual Studio to build an installer for an application that references a Measurement Studio assembly, Visual Studio automatically includes the Measurement Studio merge modules that install any referenced assemblies. Refer to Deploying Applications and Components in the Visual Studio documentation for more information on creating Visual Studio installer projects.

Measurement Studio development support also installs runtime installers for the specific versions of the assemblies that your project references. Installer Builder uses the runtime installers to deploy the same version of the assemblies to the GAC, as well as their dependencies. If you build the installer for your application on the same machine as you created the application, Installer Builder automatically selects the correct version of the runtime installer for the libraries used in your application. Refer to the Measurement Studio .NET Runtime Installers topic for more information.

Note:
If you are building an installer on a different machine than you developed it on, you need to manually choose the correct version runtime installer for the assembly referenced in your project. You can manually select runtime installers in the Installers to Include pane of the NI Drivers & Components tab within Installer Builder.

As a result of this approach, your installed application uses the exact versions of the Measurement Studio assemblies that it was built against, even if you install your application to a machine on which later versions of the Measurement Studio assemblies have been installed. The benefit of this approach is that application behavior remains constant regardless of what is subsequently installed on the system. The downside to this approach is that you must rebuild and reinstall your application or use an application configuration (app.config) file to take advantage of later versions of Measurement Studio assemblies, which might include necessary bug fixes. Refer to Redirecting Assembly Versions in the .NET Framework documentation for more information about application configuration files.

Common .NET Class Library Versioning for Deployment

Versioning and deployment of the NationalInstruments.Common.NET class library works differently than versioning of other Measurement Studio class libraries because it includes types that all Measurement Studio .NET class libraries reference. Therefore, the NationalInstruments.Common.NET class library must be compatible with all versions of Measurement Studio .NET assemblies. The NationalInstruments.Common class library merge module default setting causes the NationalInstruments.Common class library to install to the GAC along with a policy file that redirects all references to NationalInstruments.Common to the latest version of NationalInstruments.Common installed on the system. This means that by default, applications that reference NationalInstruments.Common use the latest version of NationalInstruments.Common installed on the system. NationalInstruments.Common is designed to be backward-compatible with all prior versions.

The behavior for NationalInstruments.Common is different depending on how your installer deploys it:

Note:
The policy file applies only to versions of assemblies with the same strong name. This means, for example, that a policy file for NationalInstruments.Common version 8.5.35.x will not apply to applications that reference NationalInstruments.Common version 8.5.20.x.

Versioning for Deployment of Class Libraries that Depend on Unmanaged Code

Some Measurement Studio .NET class libraries provide interfaces to COM servers or shared DLLs. The .NET DataSocket and Analysis class libraries are examples of class libraries that provide interfaces to COM servers or shared DLLs. Refer to Measurement Studio COM Servers and Shared DLL Versioning and Deployment for more information about deploying COM servers and shared DLLs.

Refer to Measurement Studio .NET Merge Modules for a complete list of Measurement Studio class libraries and corresponding merge modules.

See Also

WAS THIS ARTICLE HELPFUL?

Not Helpful