It has several sections:
- Creating the Test Application
- Building a Simple Package
- Installing a Package through the Command Line Interface (nipkg.exe)
- Using Feeds
We want to use a simple test application. This application will consist of three main parts:
- A payload (In this case is an executable)
- Dependencies, which we will have two types:
- NI Software (LabVIEW Run-Time Engine)
- Third-party Software (A custom shared library (dll) that we are going to create a NIPM package to distribute)
For detailed instructions head over to the Create Test Application section. Or you can download it from the source of this example.
There are three main ways of creating a package- Through the LabVIEW Application Builder
- Using the standalone NI Package Builder application
- Automating through the NI Package Manager command line interface
Lets start by creating a basic package for our dll using the LabVIEW Application Builder
- Open SharedLibrary.lvproj
- Right-click Build Specifications and select New » Package
- In the properties fill out the following information:
- Build Specification Name: Simple Library
- Package name: simple-library
- Destination directory:
C:\Users\<user>\Documents\NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryPackage\Package
- In Destinations create a new folder under the Program Files folder called
SimpleLibrary
- Under Source Files select
BuildSpecification » SimpleDLL
on the left and selectProgram Files\SimpleLibrary
on the right, then press the arrow pointing to the right. If you select this, you cannot add individual files from the build specification, and you have to ensure that the build specification has already been built. - Alternatively, add the
SimpleLib.dll
fromProgramFiles(x86)\SimpleLibrary
to your project and select that fromMy Computer » SimpleLib.dll
instead of selectingBuildSpecification » SimpleDLL
- Under Package fill out the following:
- Display Name: Simple Library
- Package Synopsis: Simple Lib for NIPM Tutorial
- Section: Infrastructure (hidden)
- Look under Dependencies and note that LabVIEW Runtime (32-bit) has already been selected. This means that LabVIEW Runtime will be installed when this package is installed; if it isn't already present. You see the specific package name under Package name (ni-labview-2019-runtime-engine-x86) we will use this later for the CLI version.
- Note the version in the Version window
- Under the Feed window we can add our package to a feed, which will let remotes fetch updates easier. We will skip this for now
- Select Build
- Note that the version number in the name of the package matches the version number in the build spec. As we update this build spec we can have the version number update automatically. This is useful for systems that are installing the package to know what the latest version is.
- Double-click to install the package. Pass through the prompts until it says Installation complete.
- Check
C:\Program Files (x86)\SimpleLibrary
to ensure the files are present. You can run the executable now too to ensure that it works as expected.
- Open NI Package Manager from the start menu.
- Your library should show up after following these steps:
- Select the Installed tab
- Under Category select Infrastructure
- Under Maintainer select Unregistered
- Deselect Products only
- Select the gear in the top right and check Show full version numbers and hidden packages
- Select and remove the package
-
First, we are going to follow the directions here in the help file. These directions are repeated below with some more hand holding.
-
I created a directory in my NIPM Package Tutorial folder called
\CLI Package\SimpleLibPkg
to store all of the files I will use. -
Inside the root directory (
SimpleLibPkg
), create a folder called control. -
Now lets create the control file using the directions from the help
- Using a text editor, create a new document.
- Enter all control file attributes and values needed for your package. You can find a description of these here. Enter the following for our purposes:
Package: simple-library Version: 1.0.0.0 Section: Infrastructure Architecture: windows_all Depends: ni-labview-2019-runtime-engine-x86 Maintainer: Michael Bilyk <[email protected]> Description: Simple Lib for NIPM Tutorial A simple library for use in a NIPM Tutorial (github.com/mbilyk/NIPM-tutorial) XB-Plugin: file
- Note that the package has the same name as the LabVIEW Application Builder package properties. We also are setting the the rest of the attributes to be the same as in the LabVIEW Application Builder method. We set a dependency on ni-labview-2019-runtime-engine-x86. The maintainer is a required field, you will want to replace my name with your own and my email with yours.
- Save the file as control and omit the file extension.
-
Inside the root directory (
SimpleLibPkg
), create a folder called data. This is going to be our main location for what we want to be contained in the package. -
In the data folder create a folder called
ProgramFiles_32
-
In
SimpleLibPkg\data\ProgramFiles_32
create a folder called SimpleLibrary. Notice that this is the same directory we installed our previous package to. -
Place our output dll into
SimpleLibPkg\data\ProgramFiles_32\SimpleLibrary
-
We are also going to skip creating an instructions file for now, since we will do it when we create a package for the executable.
-
Inside the root directory, create a Debian binary file. This file declares conformity to the Debian standard. For more information, visit [debian.org].
- Using a text editor, create a new document.
- Enter
2.0
- Save the file as debian-binary and omit the file extension.
-
At this point your file directory should look like this:
-
Now that we have our package directory set up we can use the command line to create the package.
-
Create a new folder in the
\CLI Package
calledPackage Output
-
Open a command prompt.
-
Change directories to the location of Package Manager. The default location is C:\Program Files\National Instruments\NI Package Manager. You can also add NI Package Manager to the %PATH% environment variable for your system.
-
Run the following command: nipkg pack <destination of .nipkg file>. For example
nipkg pack "C:\Users\<USER>\Documents\NIPM Package Tutorial\CLI Package\SimpleLibPkg" "C:\Users\<USER>\Documents\NIPM Package Tutorial\CLI Package\Package Output"
-
You should now have a package in the
NIPM Package Tutorial\CLI Package\Package Output
directory -
Run the package and ensure that it installs correctly.
-
Your done! Now remove it using the above instructions so we can do it again. Jump to here if you want to install a package using the command line interface.
-
Download and install NI Package Builder from NI Package Manager.
-
Open NI Package Builder from the start menu. I am using NI Package Builder 32-bit.
-
Click the New Package button in the middle of the screen.
-
Start typing the name of your package. In this case, it is Simple Library. If you accidentally click off of the display name, you can right-click on the Display name in the Packages pane and select Rename.
-
With the
Simple Library
package selected, in the Properties pane click on thePackage name
field (it should saymycompany-myproduct
) we are going to name itsimple-library
. This will name the .nipkg file that same as in our other examples. You can also fill out any other properties you would like such as the Maintainer. -
Change the Category to
Infrastructure (hidden)
. -
Next we need inputs. In the Inputs pane click the New Input button and select Add Folder
-
Select the folder that includes the built library:
NIPM Package Tutorial\builds\SharedLibrary\SimpleDLL
-
Drag the
SimpleDLL
folder from the Inputs pane into the[Program Files (32-bit)]
directory. -
Right-click on the
SimpleDLL
folder, select Rename, and rename it toSimpleLibrary
. -
Save the solution. I saved it here
NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryPackage\Package Builder
, and called itSimpleLibrary.pbs
. You will have to create the folder. -
Select Build Solution.
-
You should now have a file called
simple-package_1.0.0.0_windows_all.nipkg
in the folderNIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryPackage\Package Builder\Packages
-
Double-click the package to install it and test it out.
-
Uninstall as usual.
- Open a command prompt.
- Change directories to the location of Package Manager. The default location is C:\Program Files\National Instruments\NI Package Manager. You can also add NI Package Manager to the %PATH% environment variable for your system.
- At this point you will probably want to open the help for nipkg install. Run the command
nipkg help install
. This will give the following information (at least in NI Package Manager 19.0):C:\Program Files\National Instruments\NI Package Manager>nipkg help install install - Installs a package nipkg install [OPTIONS]... PACKAGES... Install packages PACKAGES... - A list of all the packages to install. A package can be specified by its name or by its path. If a package name is specified, that name must exist in one of the configured feeds. If a package path is specified (a path to a file with a .nipkg extension), the contents of this file are passed to the install. OPTIONS --accept-eulas Confirm acceptance of license agreements. Packages that require license agreements cannot be installed unless this option is specified. -y,--yes,--assume-yes Execute the installation without user confirmation. --simulate Only simulate the installation. --force-locked Force the installation of locked packages. --suppress-incompatibility-errors Suppress forward incompatibility errors. WARNING: Suppressing errors could leave your system in an unusable state. --verbose, -v Display verbose output such as detailed package information on the current operation. --proxy=[PROXYHOST] Use the specified proxy server for requests to remote machines. Specify the server using the format [protocol://]proxyhost[:port] Supported protocols include socks4, socks5, and http. --proxy-user=[CREDENTIALS] Use the specified credentials to authenticate with the proxy server. Specify the credentials using the format [user]:[password] --allow-downgrade Allow Package Manager to downgrade installed packages to fulfill the request. --allow-uninstall Allow Package Manager to remove installed packages to fulfill the request. --install-also-upgrades Allow Package Manager to upgrade installed packages to fulfill an install request. GLOBAL OPTIONS --config=[PATH],-c=[PATH] Allows the caller to specify an absolute path to a custom configuration file. ALIASES pkg-install install-pkg
- With this information, we know that in order to install our package we need to use the command:
nipkg install --accept-eulas -y "C:\Users\<USER>\Documents\NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryPackage\Package\simple-library_1.0.0-0_windows_all.nipkg"
- And that is it, it is installed. You do more complex operations that we will cover later when we want to install multiple packages at once.
Create feeds to distribute multiple packages that have dependencies on one another and consolidate package file updates in one location. You can have NI Package Manager check feed locations for updates or use SystemLink to install feeds to targets.
These directions are modified from the Creating a Feed - NI Package Manager help page
- Create a directory in
NIPM Package Tutorial\builds\SharedLibrary\
calledSimpleLibraryFeedSource
and place our newly minted package into the directory. - Create another directory in
\NIPM Package Tutorial\builds\SharedLibrary\
calledsimple-library-feed
. This is going to be the name of our feed. - Open a command prompt.
- Change directories to the location of Package Manager. The default location is
C:\Program Files\National Instruments\NI Package Manager
. - Run the following command: nipkg feed-create . In my case it looks like this:
The
C:\Program Files\National Instruments\NI Package Manager> nipkg feed-create "C:\Users\nitest\Documents\NIPM Package Tutorial\builds\SharedLibrary\simple-library-feed" "C:\Users\nitest\Documents\NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryFeedSource",
target location of feed
is going to be the directory you reference in NI Package Manager, it will contain the manifest. It will pull packages from the source directory. The feed manifest folder (in this casesimple-library-feed
) can be local to your server if you are using SystemLink server, but you would typically want to place the source directory and the feed manifest directory on a network location.
These directions are modified from the Installing Packages from a Feed help page
To install packages from a feed, you register the feed and install it from the Packages tab.
-
Open NI Package Manager and click the Settings gear.
-
Select the checkbox for Show available packages and feed management tools. Package Manager displays General and Feeds sections in the Settings dialog box.
-
In the Feeds section, click Add.
-
In the Add feed dialog box, enter a name for the feed and the feed path. The feed path should be
\NIPM Package Tutorial\builds\SharedLibrary\simple-library-feed\
and the feed name will auto-populate tosimple-library-feed
-
Click Add.
-
If you click on Settings » Feeds again you will see your feed at the bottom of the list.
-
Open the Packages tab, search for Simple Library and select the checkbox for the Simple Library and then click Install.
- Rebuild one of the packages using the above method.
- Note that doing this updates the package revision. The package should now be called
simple-package_1.0.0.1_windows_all.nipkg
- Copy that file into the Source Directory. In this case
NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryFeedSource
- Rerun the
feed-create
cmd in the command prompt:C:\Program Files\National Instruments\NI Package Manager> nipkg feed-create "C:\Users\nitest\Documents\NIPM Package Tutorial\builds\SharedLibrary\simple-library-feed" "C:\Users\nitest\Documents\NIPM Package Tutorial\builds\SharedLibrary\SimpleLibraryFeedSource",
- Close and reopen NI Package Manager.
- Click on the Updates tab and search for Simple Library. There should be an update available.
- Check the box next to the package and install the update.
- Congrats!