Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Building a .NET Interop Assembly (Windows)

LabVIEW 2009 Help

Edition Date: June 2009

Part Number: 371361F-01

»View Product Info

If you have the Microsoft .NET Framework 2.0 or higher, you can use the Application Builder to build a .NET interop assembly. You can configure settings for specified VIs to add passwords, remove block diagrams, or apply other settings. You also can select different destination directories for VIs in a .NET interop assembly without breaking the links between VIs and subVIs. Before you create a build specification or start the build process, review the Building Applications Checklist.

The LabVIEW Professional Development System includes the Application Builder. If you use the LabVIEW Base Package or Full Development System, you can purchase the Application Builder separately by visiting the National Instruments Web site.

Complete the following steps to build a .NET Interop Assembly.

Getting Started

  1. Open the LabVIEW project you want to use to build the .NET interop assembly. You must have a project open and saved to configure a build specification.
  2. Prepare the VIs you want to use to build the .NET interop assembly. Save changes to any VIs in memory.

Configuring the Build Specification

  1. Expand My Computer. Right-click Build Specifications and select New».NET Interop Assembly from the shortcut menu to display the .NET Interop Assembly Properties dialog box. If you previously hid Build Specifications in the Project Explorer window, you must display the item again to access it.
  2. Complete the following items on the Information page of the .NET Interop Assembly Properties dialog box.
    1. Enter a name for the build specification in the Build specification name text box. This name appears under Build Specifications in the Project Explorer window. The name must be unique among other build specification names in the project.
    2. Enter a filename for the .NET interop assembly in the Target filename text box. .NET interop assemblies must have a .dll extension.
    3. Enter a name for the namespace of the generated .NET interop assembly.
    4. Enter a name for the class of the generated .NET interop assembly.
    5. Enter the location for the .NET interop assembly in the Destination directory text box.
  3. Complete the following items on the Source Files page.
    1. From the Project Files tree, select the VI you want to define as an exported VI in the .NET interop assembly. You must define at least one VI to export as a function. You also can select multiple files in the Project Files tree to add several files at one time to the Exported VIs or Always Included listboxes.
      Note Note  You cannot include a polymorphic VI in the Exported VIs or Always Included listboxes. Use an instance of the polymorphic VI instead.
    2. Click the Add Item arrow button next to the Exported VIs listbox to move the selected VI to the Exported VIs listbox. The Define Prototype dialog box appears. Use this dialog box to define the parameters of the exported VI. Click the OK button to return to the .NET Interop Assembly Properties dialog box.
  1. From the Destinations page, configure destination settings and add destination directories to the .NET interop assembly.
  2. From the Source File Settings page, edit destinations and properties for individual files and folders in the .NET interop assembly.
Note Note  If you plan to distribute a .NET interop assembly that uses shared variables, do not include the .lvlib file in the .NET interop assembly. Change the Destination of the .lvlib file to a destination outside the .NET interop assembly.

Customizing Advanced Options

  1. From the Advanced page, configure advanced settings for the .NET interop assembly.
  2. From the Additional Exclusions page, configure settings to disconnect type definitions, remove unused polymorphic VI instances, and remove unused members of project libraries to reduce the size of the .NET interop assembly.
  3. From the Version Information page, configure the version number and other .NET interop assembly information.
  4. From the Run-Time Languages page, set the language preferences for the .NET interop assembly.
Note Note  The LabVIEW Run-Time Engine must be installed on any computer on which users run the .NET interop assembly. You can distribute the LabVIEW Run-Time Engine with the .NET interop assembly. (Windows) You also can include the LabVIEW Run-Time Engine in an installer.

Previewing and Building the .NET Interop Assembly

  1. From the Preview page, click the Generate Preview button to review the generated files for the .NET interop assembly.
  2. Click the OK button to update the build specification settings in the project and close the dialog box. The build specification name appears in the project under Build Specifications.

    Creating or updating the build specification does not build the .NET interop assembly. You must complete the next step to build the library.
Note Note  When you update the build specification settings, the settings become part of the project. However, you must save the project if you want to save the settings.
  1. Right-click the .NET interop assembly build specification name and select Build from the shortcut menu. You can find the resulting .NET interop assembly in the directory specified in the Destination path on the Destinations page of the dialog box.

    You also can click the Build button in the .NET Interop Assembly Properties dialog box to build the .NET interop assembly and update the build specification.
Note Note  If you want to call the .NET interop assembly you build using the Application Builder outside of the LabVIEW development environment, you must reference NationalInstruments.LabVIEW.Interop.dll in the Microsoft Visual Studio project. The LabVIEW Run-Time Engine automatically installs NationalInstruments.LabVIEW.Interop.dll to the Global Assembly Cache.

You can duplicate build specifications. Right-click the build specification item you want to duplicate and select Duplicate from the shortcut menu to create a copy of the build specification item.

If you rebuild a given specification, LabVIEW overwrites the existing files from the previous build that are part of the current build.

You also can build a .NET interop assembly programmatically from a build specification.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit