我正在使用' 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。
答案 0 :(得分:0)
将EXE包装到MSI中是一种不好的做法,因为它会创建所谓的" Trojan" MSI。它似乎是一个MSI,但没有MSI的任何优点或一致性。 .NET Framework设置是一个EXE,可在内部调用多个MSI / MSP。您无法在MSI中包装MSI,因为有一个系统级互斥锁可以防止这种情况发生。
我建议您查看InstallShield Suite安装程序或Windows Installer XML Burn之类的内容,以创建一个将这些程序包链接在一起的引导程序。