InnoSetup installation success!

Started by LanceG, April 09, 2009, 12:45:34 PM

Previous topic - Next topic

LanceG

Back in 2007, velasquez said:
Quote from: velasquez on September 01, 2007, 06:42:34 AM
Hi Owen, 
I posted my installation program working with the file msi. 
See the file in http://www.easycad.com.br/opendcl/MyRunTime.zip 
I used the command line I only lower to test. 
msiexec.exe /passive /i OpenDCL.Runtime.ENU.4.0.3.1.msi 
After the installation I didn't get to see different in the windows registry. 
I work with Windows XP. 
Please tell me what am doing wrong.
He apparently was not able to get his InnoSetup install script working.

I built one yesterday, and it works pretty well.

I was able to install the runtime using the MSI file with MSIEXEC.  A big improvement over velasquez's attempt is that the Uninstall process also removes the MSI.

For those interested, the syntax for the MSIEXEC call is sort of convoluted:

[Run]
Filename: misexec.exe; Parameters: "/i ""{app}\OpenDCL.Runtime.5.1.0.2.msi"""
[UninstallRun]
Filename: misexec.exe; Parameters: "/x ""{app}\OpenDCL.Runtime.5.1.0.2.msi"""

So far I have not been able to get the "/passive" switch to work.  The main thing that this does is to eliminate the "Preparing to install..." prompt.  I'm guessing that the quotes will also be an obscure structure like the above.

The reason I used the {app} directory for the above is that if you use a {tmp} directory like velasquez did, the uninstall process won't be able to find the uninstall file, and the uninstall of the MSI will fail.  The use of {tmp} means that InnoSetup will create its own temporary directory during installation and then delete it, making it unavailable at uninstall time.

During the uninstall, you see the usual "Are you sure you want to remove XXX and its components?", followed immediately by a Windows Installer dialog that says "Are you sure you want to uninstall the product?".  The second one of course refers to the MSI uninstall.  Other than this, the uninstall works like a champ.

The only thing I'm not crazy about with this process is that you must install to a directory on the support path, or else add your install directory to the path after installing.  This has nothing to do with the MSI, of course (it works great!), but I suspect that if you supply a VLX containing your odcl file and LSP, this problem probably will go away.  I'm a newbie and haven't tried it yet.

I posted this because though Barry's tutorial is excellent, about the only thing it's missing is a description of the use of an installer.  InnoSetup is free, and not terribly difficult to learn (just what you need, yet another scripting language!).  The CADWERX AutoCAD add-on for InnoSetup (I think I got the name right...) takes care of issues relating to AutoCAD versions and support paths, but I chose to write my own with individual selections for different AutoCADs on the same computer.  Fortunately this is not needed for a simple OpenDCL installation, though if your AutoLISP is version-specific you might need to deal with it.

If there's any interest, I'll post back with further InnoSetup adventures.  Meanwhile, here's my first attempt at an InnoSetup script.  You can read it with Notepad.

BazzaCAD

Great work LanceG.
Yes I skimmed over this in the tutorial as I have no experience with installers. :)
Please keep your InnoSetup adventures coming, we definitely need someone on the team with installers experience.
If you'd like to write up some type of short tutorial on how to setup InnoSetup & incorporate a ODCL project & the runtime, we could put it in with the samples and\or the tutorial sections of the web site.

thx,
Barry
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Lance, the /q switch eliminates the UI during install and uninstall.  Also, there is no need to install the MSI file. Windows Installer caches this file automatically. The trick is to use the cached version to uninstall. You can do this by specifying the "product code" GUID instead of the MSI filename. The product code GUID changes with each build of OpenDCL, so you have to either extract it when you're building your installation script, or look it up at uninstall time by searching the Windows Installer cache.
Owen Wengerd (Outside The Box) / ManuSoft

LanceG

Wow, guys -- I'm happy to help out.  The OpenDCL package is so cool that it just seemed logical to create an install routine that works with it.  I'll write up a tutorial in between my efforts to create a "perfect" install.

Owen, I'm afraid I'm a little bit confused about the "no need to install the MSI file" business.  I thought that the best way to propagate OpenDCL to customers was by sending them the Runtime MSI.  I don't get how "Windows Installer caches this file automatically".  It seems as though MSIEXEC would not know what MSI to run if you didn't provide it.  Do you mean that somehow Windows Installer (MSIEXEC) caches the Runtime's GUID on my (development) computer when I installed it, and that's what I need to use?  I also am not sure how to extract that GUID.  If you don't mind, could you give me a hint?  I mean, I know a lot about InnoSetup, but have never worked with MSIEXEC before other than as an end user.  I do plan to mess with the switches some more after I figure out how to deal with three pass parameters.

Thanks for your enthusiasm.  I do like this product!

Lance

LanceG

OK, I was able to quiet the MSIEXEC by adding the third parameter, and figured out the quotes business.  The reason for the double quotes around ""{app}\OpenDCL.Runtime.5.1.0.2.msi"" is that Inno Setup requires them whenever a file name or directory contains a SPACE.  The whole line then becomes
[Run]
Filename: misexec.exe; Parameters: "/i ""{app}\OpenDCL.Runtime.5.1.0.2.msi"" /qn"

The /qn switch removes the UI, much like Owen said -- the "n" means "no UI"

Now the MSIEXEC part is completely invisible during installation.  Unfortunately the same switch doesn't work during the uninstall process.

BTW if you're working on running MSIEXEC from the command line, you soon learn that if you do it wrong, a dialog pops up with the command syntax info -- i think of it as the "YOU DUMMY" dialog.

As for Owen's info about using GUIDs rather than MSI files, I just downloaded the Windows Installer SDK to try to learn the intricacies of MSIEXEC.  We'll see what I glean from it.

Lance

owenwengerd

Quote from: LanceG on April 09, 2009, 01:39:52 PM
Owen, I'm afraid I'm a little bit confused about the "no need to install the MSI file" business.

What I meant is that you don't have to "install" the MSI file on the end user's system. You do have to include it in your distribution, and "run" it via MSIEXEC. When you run MSIEXEC, Windows caches the MSI file in the installer cache for you. Your uninstall can then use the cached MSI file.
Owen Wengerd (Outside The Box) / ManuSoft

velasquez

Hi LanceG, 
Great work with InnoSetup. 
Do you have a Script for selection of the versions of AutoCAD in an only computer? 
Does it can me to supply a sample? 
I didn't still get to work with this. 

Thanks

LanceG

velasquez -- Thanks for dropping by here.  I'll see if I can prune my huge install script to demonstrate the selection of AutoCAD version and will write back with an example.

Owen -- Thank you for clarifying about the uninstall of the cached version.  I'll look into how to use it rather than running MSIEXEC on the MSI itself, though the main thing I'd like to gain is a cleaner looking uninstall, and not necessarily a decrease in files stored on the computer.  Let's see how it works.  It will be an interesting Inno Setup exercise at least.

I'm working on a tutorial, trying to decide what to include and what to leave out.  Barry's tutorial is a pretty good model (though I'd put in a little more detail in the OpenDCL sample project...).

Lance

LanceG

velasquez -- Here is an Inno Setup subroutine I use to detect AutoCADs from 2006 to 2010:

AC2006, AC2007, AC2008, AC2009, AC2010 are booleans that get set true if those versions are installed.
NumVersions is the number of versions installed between 2006 and 2010

Obviously you could extend the versions to detect by searching the registry for strings prior to 'R16.2'.
...
// Get AutoCAD versions -- saved as Versions[0] through [4] (2006 through 2010)
function GetVersions():Integer;
var
   I: Integer;
begin
   if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'Software\Autodesk\AutoCAD\',Versions) then
   begin
      NumVersions := GetArrayLength(Versions);
      for I := 1 to GetArrayLength(Versions) do
         case Versions[I-1] of
           'R16.2': begin
            AC2006 := True;
           end;
           'R17.0': begin
            AC2007 := True;
           end;
           'R17.1': begin
            AC2008 := True;
           end;
           'R17.2': begin
            AC2009 := True;
           end;
           'R18.0': begin
            AC2010 := True;
           end;
         end;
      Result := NumVersions;
   end else begin
      MsgBox('Cannot locate AutoCAD.',mbCriticalError, MB_OK);
      Result := NumVersions;
   end;
end;
...

velasquez

Thank you very much Lance 
Very good your work. 
Did you already create some thing where the user selects a version?

LanceG

Yes.  There's a custom Inno Setup page in the installation of my AutoCAD add-on where all installed versions of all installed verticals are displayed with check boxes.  The user selects the version(s) for which he/she wants the installation and the install program places it there.  The program is quite complex but it works well.  I don't want to post it all because it involves MANY MANY hours of work, but I'll be glad to help with OpenDCL installation issues.

Lance

velasquez

Quote from: LanceG on April 14, 2009, 01:18:26 PM
velasquez -- Here is an Inno Setup subroutine I use to detect AutoCADs from 2006 to 2010:

AC2006, AC2007, AC2008, AC2009, AC2010 are booleans that get set true if those versions are installed.
NumVersions is the number of versions installed between 2006 and 2010

Obviously you could extend the versions to detect by searching the registry for strings prior to 'R16.2'.
...
// Get AutoCAD versions -- saved as Versions[0] through [4] (2006 through 2010)
function GetVersions():Integer;
var
   I: Integer;
begin
   if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'Software\Autodesk\AutoCAD\',Versions) then
   begin
      NumVersions := GetArrayLength(Versions);
      for I := 1 to GetArrayLength(Versions) do
         case Versions[I-1] of
           'R16.2': begin
            AC2006 := True;
           end;
           'R17.0': begin
            AC2007 := True;
           end;
           'R17.1': begin
            AC2008 := True;
           end;
           'R17.2': begin
            AC2009 := True;
           end;
           'R18.0': begin
            AC2010 := True;
           end;
         end;
      Result := NumVersions;
   end else begin
      MsgBox('Cannot locate AutoCAD.',mbCriticalError, MB_OK);
      Result := NumVersions;
   end;
end;
...


Hi Lance,
 
I have little experience with the language used in InnoSetup. 
Can you happen an example of this code working? 

Thank you very much. 
Velasquez