รวมการติดตั้งหลายรายการไว้ใน MSI

ฉันใช้ 'MSI Wrapper v5.1.89.0' โดย exemsi.com เพื่อแปลงการติดตั้งที่สร้างด้วย '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 ใด ๆ


person SPlatten    schedule 29.10.2014    source แหล่งที่มา
comment
พบสิ่งนี้: stackoverflow.com/ คำถาม/16530866/   -  person SPlatten    schedule 29.10.2014
comment
น่าเสียดายที่โซลูชันนี้ใช้งานไม่ได้ พยายามเปิด MSI โดยใช้: msiexec.exe /quiet /i netfx_Full_x64.msi ไม่ทำงาน   -  person SPlatten    schedule 29.10.2014


คำตอบ (1)


การรวม EXE เข้ากับ MSI ถือเป็นแนวทางปฏิบัติที่ไม่ดี เนื่องจากจะสร้างสิ่งที่เรียกว่า MSI "โทรจัน" ดูเหมือนว่าจะเป็น MSI แต่ไม่มีข้อดีหรือความสม่ำเสมอของ MSI การตั้งค่า .NET Framework เป็น EXE ที่เรียกใช้ MSI / MSP หลายตัวภายใน คุณไม่สามารถรวม MSI ไว้ใน MSI ได้เนื่องจากมี mutex ระดับระบบที่ป้องกันสิ่งนี้

ฉันขอแนะนำให้คุณดูบางอย่างเช่น InstallShield Suite Installers หรือ Windows Installer XML Burn เพื่อสร้าง bootstrapper เพื่อเชื่อมโยงแพ็คเกจเหล่านี้เข้าด้วยกัน

person Christopher Painter    schedule 29.10.2014
comment
ฉันใช้ MS Visual Studio 2013 ด้วยเหตุผลบางประการที่เฟรมเวิร์กไม่พร้อมใช้งานในรูปแบบ MSI และฝ่ายไอทีออกได้เฉพาะ MSI โดยใช้นโยบายกลุ่มเท่านั้น - person SPlatten; 30.10.2014
comment
การปรับใช้นโยบายกลุ่มนั้นมีข้อจำกัดอย่างมากในด้านสิ่งที่สามารถทำได้ การออกแบบของคุณไม่สามารถแก้ไขกล่องนั้นได้ - person Christopher Painter; 30.10.2014
comment
ฉันประหลาดใจที่เฟรมเวิร์ก .NET ใช้งานได้เฉพาะเมื่อติดตั้ง .EXE เนื่องจากนโยบายกลุ่มนั้นสามารถเผยแพร่ได้เฉพาะ MSI เท่านั้น - person SPlatten; 31.10.2014
comment
พิจารณาว่านโยบายกลุ่มนั้นถูกสร้างขึ้นโดยแผนกหนึ่งของ MSFT และเฟรมเวิร์ก .NET นั้นอีกแผนกหนึ่ง ย้อนกลับไปตอนนั้นตัวติดตั้ง .NET นั้นเรียบง่ายพอที่จะปรับใช้ผ่าน GPO ได้ จากนั้นพวกเขาก็รวมสถาปัตยกรรมแพลตฟอร์มทั้งหมดเข้าไว้ใน EXE เดียว และไม่เหมาะกับโมเดล GPO อีกต่อไป พวกเขาอาจจะไม่ได้กังวลเกี่ยวกับเรื่องนี้มากนักเพราะนั่นคือเหตุผลที่พวกเขาขาย SCCM สำหรับวิธีการแฮ็กขั้นสูงในการปรับใช้ .NET ผ่าน GPO โปรดดู: blogs.msdn.com/b/astebner/archive/2010/06/04/10020299.aspx - person Christopher Painter; 31.10.2014
comment
ฉันคิดว่าแผนกไอที พบว่าพวกเขาสามารถเปิดตัวการอัปเดต .NET โดยใช้การอัปเดต Windows ได้....ฉันกำลังพยายามเปิดตัว MSI x86 และ x64 ด้วย แต่น่าเสียดายที่ฉันต้องตรวจสอบประเภทระบบ จากนั้นเลือก MSI ที่จะปรับใช้ - person SPlatten; 31.10.2014