0

I am using 'MSI Wrapper v5.1.89.0' by exemsi.com to convert an installation created with 'Inno Setup Compiler v5.5.5(a)'.

The script for the installation is as follows:

[Setup]
AppName=Personal Time Keeping
AppVersion=1.0.2.1
DefaultDirName={pf}\PTK
DefaultGroupName=group name
UninstallDisplayIcon={app}\ptk.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64-bit mode" on x64, meaning it should use the native
; 64-bit Program Files directory and the 64-bit view of the registry.
; On all other architectures it will install in "32-bit mode".
ArchitecturesInstallIn64BitMode=x64
; Note: We don't set ProcessorsAllowed because we want this
; installation to run on all architectures (including Itanium,
; since it's capable of running 32-bit code too).

[InstallDelete]
Type: files; Name: "{userappdata}\Microsoft\Windows\Start Menu\Programs\Startup\ptk.exe -   Shortcut.lnk"

[Files]
;Ensure all the prerequisites are installed
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; Check: needsFramework; DestDir: "{tmp}"; DestName: "NDP451.exe"; Flags: deleteafterinstall; 
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\VisualBasicPowerPacks3Setup.exe"; Check: needsPowerPacks; DestDir: "{tmp}"; DestName: "VBPP3.exe"; Flags: solidbreak
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\sharepointclientcomponents_x64.msi"; Check: (IsWin64 and needsSharePtClient); DestDir: "{tmp}"; DestName: "sharept.msi"; Flags: solidbreak
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\sharepointclientcomponents_x86.msi"; Check: ((not IsWin64) and needsSharePtClient); DestDir: "{tmp}"; DestName: "sharept.msi"; Flags: solidbreak
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\mysql-connector-net-6.8.3.msi"; Check: needsMySQLNET; DestDir: "{tmp}"; DestName: "mysqlNET.msi"; Flags: solidbreak
Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\mysql-connector-odbc-5.3.2-win32.msi"; Check: needsMySQLODBC; DestDir: "{tmp}"; DestName: "mysqlODBC.msi"; Flags: solidbreak
;The application to install
Source: "C:\3subTimeKeeingApp\3sunptk\3sunptk\bin\Release\3sunptk.exe"; DestDir: "{app}"; BeforeInstall: CloseApp('3sunptk.exe');
;Transfer reports folders and files
Source: "C:\3subTimeKeeingApp\3sunptk\report\*"; DestDir: "{app}\report"; Flags: ignoreversion recursesubdirs

[Run]
;Uninstall of older verison of 'Personal TimeKeeping' application
Filename: "{sys}\rundll32.exe"; Parameters: "dfshim.dll,ShArpMaintain 3sunptk.application, Culture=en-GB, PublicKeyToken=077ce3637efc8b1c, processorArchitecture=msil"; Check: isOldStyleInstalled; StatusMsg: Uninstalling older version of Personal Timekeeping; Flags: runascurrentuser;
;Install the MSI's quietly "/passive /norestart /q:a /c:""install /l /q"""
Filename: {tmp}\NDP451.exe; Parameters: "/passive /norestart /c:""install /l /q"""; StatusMsg: Microsoft Framework 4.5.1 is being installed. Please wait..                  
Filename: "{tmp}\VBPP3.exe"; Parameters: "/s /v""/qb"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: Installing Visual Basic Power Packs 3.
Filename: "msiexec.exe"; Parameters: "/quiet /i ""{tmp}\sharept.msi"""; StatusMsg: Installing Sharepoint client tools.
Filename: "msiexec.exe"; Parameters: "/quiet /i ""{tmp}\mysqlNET.msi"""; StatusMsg: Installing mySQL .NET connector.
Filename: "msiexec.exe"; Parameters: "/quiet /i ""{tmp}\mysqlODBC.msi"""; StatusMsg: Installing mySQL ODBC connector.
;Start the application
Filename: "{app}\3sunPTK.exe"; Description: "Launching 3sun Personal Timekeeping"; Flags: nowait postinstall skipifsilent;

[Icons]
Name: "{commonstartup}\3sun Personal Timekeeping"; Filename: "{app}\3sunPTK.exe"

[Code]
//--------------------------------------------------------------------------------
// Visual Basic Power Packs
//--------------------------------------------------------------------------------
function isVBPowerPacks3installed(): Boolean;
    var 
        success: Boolean;
        productName: String;
    begin
        success := RegQueryStringValue(HKCU, 
            'Software\Microsoft\Installer\Products\B391D4B7D67DB803B821D5B91BBCECC6', 
            'ProductName', 
            productName);
        Result := success and (productName = 'Microsoft Visual Basic Power Packs 3.0');
    end;

function needsPowerPacks(): Boolean;
    begin
        Result := (isVBPowerPacks3installed = False);
    end;  
//--------------------------------------------------------------------------------
// .NET helpers
//--------------------------------------------------------------------------------
function isDotNet451Detected(): Boolean;
    var 
        success: Boolean;
        release: Cardinal;
    begin
        success := RegQueryDWordValue(HKLM, 
                    'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\', 
                    'Release', 
                    release);
//For .net versions
//http://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx#net_b 
        Result := success and (release = 378758);
    end;

function needsFramework(): Boolean;
    begin
        Result := (isDotNet451Detected = False);
    end;
//--------------------------------------------------------------------------------
// MySQL .NET connector 6.8.3
//--------------------------------------------------------------------------------
function isMySQLNETconnectorInstalled(): Boolean;
    var 
        success: Boolean;
        version: String;
    begin
        success := RegQueryStringValue(HKLM, 
                    'SOFTWARE\Wow6432Node\MySQL AB\MySQL Connector/Net\', 
                    'Version', 
                    version); 
        Result := success and (CompareStr(version, '6.8.3') = 0);
    end;

function needsMySQLNET(): Boolean;
    begin
        Result := (isMySQLNETconnectorInstalled = False);
    end;
//--------------------------------------------------------------------------------
// MySQL ODBC Connector 5.3
//--------------------------------------------------------------------------------
function isMySQLODBCconnectorInstalled(): Boolean;
    var
        success: Boolean;
        version: String;
    begin
        success := RegQueryStringValue(HKLM, 
                        'SOFTWARE\MySQL AB\MySQL Connector/ODBC 5.3\', 
                        'Version', 
                        version); 
        Result := success and (CompareStr(version, '5.3.2') = 0);
    end;

function needsMySQLODBC(): boolean;
    begin
        Result := (isMySQLODBCconnectorInstalled = False);
    end;
//--------------------------------------------------------------------------------
// Sharepoint client components
//--------------------------------------------------------------------------------
function isSharepointClientInstalled(): Boolean;
    begin
        Result := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\SharePoint Client Components');
    end;

function needsSharePtClient(): Boolean;
    begin
        Result := (not isSharepointClientInstalled);
    end;
//--------------------------------------------------------------------------------
// Checks if the application is installed witht the old style installation 
//--------------------------------------------------------------------------------
function isOldStyleInstalled(): Boolean;
    var 
        success: Boolean;
        uninstall: String;
    begin
        success := RegQueryStringValue(HKCU, 
                        'Software\Microsoft\Windows\CurrentVersion\Uninstall\4f2a8fa50dcb64ac', 
                        'UninstallString', 
                        uninstall);
        Result := success and (Length(uninstall) > 0);
    end;
//--------------------------------------------------------------------------------
// Close application
//--------------------------------------------------------------------------------
const wbemFlagForwardOnly = $00000020;
procedure CloseApp(AppName: String);
    var
        WbemLocator  : Variant;
        WMIService   : Variant;
        WbemObjectSet: Variant;
        WbemObject   : Variant;
    begin;
        WbemLocator   := CreateOleObject('WbemScripting.SWbemLocator');
        WMIService    := WbemLocator.ConnectServer('localhost', 'root\CIMV2');
        WbemObjectSet := WMIService.ExecQuery('SELECT * FROM Win32_Process Where Name="' + AppName + '"');
        if not VarIsNull(WbemObjectSet) and (WbemObjectSet.Count > 0) then
            begin
                WbemObject := WbemObjectSet.ItemIndex(0);
                if not VarIsNull(WbemObject) then
                    begin
                        WbemObject.Terminate();
                        WbemObject := Unassigned;
                    end;
            end;
    end;

This works fine without problem when run as setup.exe but when run as setup.msi, it gets as far as the .dotNET Framework 4.5.1 then wants to wait for another setup to complete, which I do not see. Eventual it will end but doesn't install any of the frameworks or MSI's.

SPlatten
  • 5,334
  • 11
  • 57
  • 128
  • Found this: http://stackoverflow.com/questions/16530866/installshield-with-net-4-5-nested-installation – SPlatten Oct 29 '14 at 10:08
  • Sadly this solution doesn't work, trying to launch the MSI using: msiexec.exe /quiet /i netfx_Full_x64.msi doesn't work. – SPlatten Oct 29 '14 at 10:19

1 Answers1

0

Wrapping an EXE into an MSI is a bad practice as it creates what is called a "Trojan" MSI. It appears to be an MSI but doesn't have any of the advantages or consistency of an MSI. The .NET Framework setup is an EXE that calls multiple MSI's / MSP's internally. You can't wrap an MSI inside an MSI because there is a system level mutex that prevents this.

I suggest you look at something like InstallShield Suite Installers or Windows Installer XML Burn to create a bootstrapper to chain these packages together.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • I'm using MS Visual Studio 2013, for some reason the framework isn't available as an MSI, and out IT dept can only roll out MSI's using group policy. – SPlatten Oct 30 '14 at 16:09
  • Group policy deployment is very limited in what it can do. Your design won't fix that box. – Christopher Painter Oct 30 '14 at 17:33
  • I'm amazed that the .NET frameworks are only available as .EXE installs given that group policy can only roll out MSI's. – SPlatten Oct 31 '14 at 08:35
  • Consider that group policy was created by one division of MSFT and that .NET framework another. Back then the .NET installer was simple enough that it could be deployed via GPO. Then they unified all the platform architectures into a single EXE encapsulation and it no longer fit the GPO model. They probably didn't worry about it too much because that's why they sell SCCM. For an extreme hack way of deploying .NET via GPO see: http://blogs.msdn.com/b/astebner/archive/2010/06/04/10020299.aspx – Christopher Painter Oct 31 '14 at 11:24
  • I think out IT dept. have found they can roll out the .NET update using Windows updates....I'm also trying to roll out x86 and x64 MSI's, unfortunately I have to detect the system type and then choose an MSI to deploy. – SPlatten Oct 31 '14 at 17:52