Installation 将多个安装打包到MSI中

Installation 将多个安装打包到MSI中,installation,windows-installer,exe,Installation,Windows Installer,Exe,我正在使用exemsi.com提供的“MSI Wrapper v5.1.89.0”转换使用“Inno Setup Compiler v5.5.5(a)”创建的安装 安装的脚本如下所示: [Setup] AppName=Personal Time Keeping AppVersion=1.0.2.1 DefaultDirName={pf}\PTK DefaultGroupName=group name UninstallDisplayIcon={app}\ptk.exe Compression=l

我正在使用exemsi.com提供的“MSI Wrapper v5.1.89.0”转换使用“Inno Setup Compiler v5.5.5(a)”创建的安装

安装的脚本如下所示:

[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;

当以setup.exe运行时,它可以正常工作,没有问题,但当以setup.msi运行时,它会一直运行到.dotNET Framework 4.5.1,然后希望等待另一个安装完成,我没有看到。最终它将结束,但不会安装任何框架或MSI。

将EXE包装到MSI中是一种不好的做法,因为它会创建所谓的“特洛伊木马”MSI。它似乎是一个MSI,但没有MSI的任何优势或一致性。.NET Framework安装程序是一个在内部调用多个MSI/MSP的EXE。您不能将MSI包装在MSI中,因为有一个系统级互斥锁可以防止这种情况发生


我建议您使用InstallShield Suite Installer或Windows Installer XML Burn之类的工具来创建一个引导程序来将这些包链接在一起。

发现:遗憾的是,此解决方案不起作用,尝试使用:msiexec.exe/quiet/I netfx_Full_x64.MSI启动MSI不起作用。我使用的是MS Visual Studio 2013,由于某些原因,该框架不能作为MSI提供,而out IT部门只能使用组策略推出MSI。组策略部署的功能非常有限。您的设计将无法修复该框。我很惊讶.NET框架只可用为.exe安装,因为组策略只能推出MSI。考虑组策略是由MSFT的一个分区和.NETFramework的另一个分区创建的。当时的.NET安装程序非常简单,可以通过GPO进行部署。然后,他们将所有平台架构统一到一个EXE封装中,它不再适合GPO模型。他们可能并不太担心,因为这就是他们出售SCCM的原因。要了解通过GPO部署.NET的极端黑客方法,请参阅:我想IT部门已经发现他们可以使用Windows更新推出.NET更新…我还尝试推出x86和x64 MSI,不幸的是,我必须检测系统类型,然后选择要部署的MSI。