Specifying Which Version of a .NET Assembly to Use

LabVIEW 2018 Help


Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2015 Help
LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help

If you have multiple versions of the same assembly on your machine, you must specify which version of the assembly to use in the following situations:

  • You originally configure a .NET Constructor Node to load one version of the assembly but later want the node to access a different version of the assembly. LabVIEW permanently associates the original version of the assembly with your application. Therefore, you cannot access properties, methods, and behaviors of the alternate version until you create the configuration file.
  • You distribute your application to another machine that may have multiple versions of the assembly. Specifying which version of the assembly to use ensures that the distributed application detects and uses the correct version. You must distribute the configuration file with the application.

To guarantee that a LabVIEW project or built application refers to a specific version of a .NET assembly, close the project and create a .NET configuration file similar to the following example, replacing the italicized code according to the table later in this topic:


<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Assembly\ver2"/>
<dependentAssembly>
<assemblyIdentity name="AssemblyName"
publicKeyToken="xee7d93a67000dr7"
culture="Neutral" />
<bindingRedirect oldVersion="oldVersionNumber" newVersion="newVersionNumber" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Code to ReplaceGuidelines
probing privatePath="Assembly\ver2"Specifies the directory within the project from which LabVIEW must load the assembly. If you can guarantee that the assembly is in the Global Assembly Cache (GAC), omit this line from the configuration file. Otherwise, this line forces LabVIEW to search in this directory before anywhere else.
AssemblyNameRepresents the name of the assembly with multiple versions.
xee7d93a67000dr7Uniquely identifies the assembly. Generate this key using the Strong Name tool, available on the Microsoft Developer Network (MSDN).
oldVersionNumberRefers to the version of the assembly that LabVIEW is currently using in the form n.n.n.n. To prevent LabVIEW from using multiple different versions of the assembly, specify a range of versions here using the form n.n.n.n - n.n.n.n.
newVersionNumberRefers to the version of the assembly that you want LabVIEW to use instead of oldVersionNumber.

For examples of using .NET configuration files with LabVIEW, refer to the KnowledgeBase at ni.com.

WAS THIS ARTICLE HELPFUL?

Not Helpful