LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

understand the product code in labview 8.6 installer

I want to understand how the LabVIEW 8.6 project installer build generates and maintains the Product Code GUID.  Is this generated new for every build of the installer?  Here is some background for why I would like to better understand this feature:

 

Consider a small project that builds an executable:  "my program.exe"

 

Create an installer for this program that includes the LabVIEW 8.6 Run-time, and puts a shortcut to the new program in the target "start menu > programs > my programs" folder.  I wanted to put an additional shortcut in the same menu folder for uninstalling the program, "my program uninstall".

 

The first way I tried this was to wrap a system exec call in a VI and build it to a separate program, "my program uninstall.exe" that would install with the first.  I never could get the uninstallation to work through system exec, however, with either the NI uninstaller (...\Program Files\National Instruments\Shared\NIUninstaller\uninst.exe), or the M$ program msiexec.exe.

 

Next, I decided to try to create the uninstall shortcut ahead of time, on my development machine, and install it along with the program.  This seemed promising, as I could create a shortcut for msiexec.exe, and use the M$ documentation to call the following:

 

 msiexec.exe /x {install.msi | Product Code}

 

Now, however, I'm faced with the problem of knowing what is the product code for my installation?

 

BTW, it was not easy to add a shortcut file to a project to get it to install with the project.  I had to essentially strip of the file extension (.lnk) and set the shortcut to be renamed back with the extension in the EXE build.

 

Thanks anyone for advice,

James

0 Kudos
Message 1 of 6
(3,869 Views)
0 Kudos
Message 2 of 6
(3,837 Views)

I have read that article, but it's not quite what I'm looking for.  After pondering the problem a bit more, I came up with solution based around the NI Uninstaller.  Follow these instructions to install a shortcut on the target machine to uninstall the package (Windows-based systems):

 

  1. Create the uninstaller link "my program uninstall.lnk" that will be used for the shortcut on the target machine:

    Shortcut target:  "%ProgramFiles%\National Instruments\Shared\NIUninstaller\uninst.exe" /qb /x "my program"
    Shortcut start in: "%ProgramFiles%\National Instruments\Shared\NIUninstaller\"
  2. Use a cmd prompt to remove the extension (.lnk) from the new shortcut. 
    I couldn't figure out how to do the file rename with Windows Explorer, but at
    command prompt it is:

    >rename "my program uninstall.lnk" "my program uninstall"

  3. Add the shortcut with the stripped extension to the LabVIEW project

  4. Add the stripped shortcut to the target files of the project EXE build

  5. Select "Rename this file in the build" for the stripped shortcut,
    and add the extension back ".lnk"

  6. In the project install build spec, "my program install", add a
    shortcut to the [ProgramMenuFolder] (or other location(s)) and select the
    stripped shortcut from the EXE build spec.

 

That seems to work; the only drawback perhaps is that it uninstalls EVERYTHING (LVRT etc + my program).

 


James

0 Kudos
Message 3 of 6
(3,818 Views)

Microsoft's perplexing installer guidlines are something like this:

 

 

  • When you create a brand-new application, an "upgrade code" GUID is generated by the builder. It does not change over the lifetime of the product. 
  • Any new version of that application gets its own "product code" GUID, so this changes every build.
  • The windows installer msiexec will allow you to upgrade a product with the same upgrade code, but...
  • Msiexec will refuse to "downgrade"; you need to uninstall e.g. version 4.1 before you can install 4.0.
 
Further complicating matters, the installer in LabView 8+ is unrelated to the installer builder in LabView 7, and I don't believe that it maintains upgrade codes between versions. 
 
Where this goes from "perplexing" to "annoying" is that msiexec (which can uninstall using the /x option) doesn't know anything about upgrade codes. It only knows about the (constantly changing) product codes. If you know the product code of your previous release, great; just call msiexec /x {GUID}. But if you know only the upgrade code, you need to look up the product code using the WinAPI call MSIEnumRelatedProducts.
 
There's a good description of this on Oliver Goldman's blog   . He also has a little command line wrapper around the above call that allows you to ferret out the product code from the command line.
 
If you use a DOS batch script for your installer, the following bit of DOS obscurity might be helpful; you can assign the result of a command to variable using FOR command. (SET %foo = blahblah) would be too obviously useful, apparently.) So the following:

@echo Removing Application...
set upgradecode={EF503BAD-FFFF-490E-8888-5DB6F736CEF4}
FOR /F %%a in ('.\msiu2p.exe %upgradecode%') do msiexec /qb /x %%a 
 
calls Goldman's application to get the product code, then calls msiexec to do the uninstallation.
 
-Rob 

 

0 Kudos
Message 4 of 6
(3,766 Views)

I forgot to note how to find you upgrade code. In LabView 8.6.1 it is stored in the .lvproj file.

 

1. Copy your project file and rename it project.xml or whatever.

2. Open in Internet Explorer or other xml editor

3. Find <Item Name="Build Specifications" Type="Build">

4. Open your Installerbuildspec. (i.e. <Item Name="MyInstaller" Type="Installer">

5. Find  <Property Name="UpgradeCode" Type="Str">. Copy out the GUID, including braces.

 

You might be able to dig it out using a property nodes of the project from within LabView. That would be less gross. In any event you only have to do it once.

0 Kudos
Message 5 of 6
(3,763 Views)

Rob,

Thanks for the breakdown and useful suggestions.  I will definitely bookmark this thread as a good resource for later.  In the meantime I've decided to rely on the NI uninstaller which can use the product name, and I've now hacked around enough to figure out how to get a proper shortcut installed to call it.

 

James

0 Kudos
Message 6 of 6
(3,743 Views)