Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:innosetup_installer [2011/04/04 13:14] smayr |
systems:innosetup_installer [2020/08/26 12:06] (current) ajdavis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | == InnoSetup Installer | + | = InnoSetup Installer = |
- | === Detected .NET Framework | + | == Detected .NET Framework == |
Source: [[http:// | Source: [[http:// | ||
Line 17: | Line 17: | ||
Having the .NET Framework as a dependency makes the installation requirements somewhat complex. | Having the .NET Framework as a dependency makes the installation requirements somewhat complex. | ||
- | | + | * You need to detect whether the framework is already installed. |
- | The Framework needs to be installed by an administrator, | + | |
- | You don’t want to distribute the framework with your application. | + | |
- | You don’t want to force people to download the Framework if they don’t need to, ie. they have a local copy. | + | |
- | The installation of the product should not go ahead if the .NET Framework installation fails or is cancelled. | + | |
** The Script ** | ** The Script ** | ||
Line 27: | Line 27: | ||
The script that I ended up with performs the following processing: | The script that I ended up with performs the following processing: | ||
- | | + | * Requires Windows 98 or Windows NT4 or later. For simplicity it does not check for the required NT4 service pack or Internet Explorer 5.01 - I don’t think many systems that back level will be installing new software. However in testing I did verify that if the version of IE is too low, the .NET Framework installation asks for it to be upgraded. |
- | If the .NET Framework is not installed and the user is not logged on as an administrator, | + | |
- | If the .NET Framework is not installed, it looks for the dotnetfx.exe file in the same location as the setup file. If it is not found, it downloads it from Microsoft. | + | |
- | Installs the .NET Framework if required. | + | |
- | If the .NET Framework installation was successful or it was already installed, installs the application. | + | |
I haven’t programmed in Pascal, and this was my first shot at an Inno Setup script, so there are probably plenty of opportunities for tidying things up. A lot of what I did was just copying and modifying stuff. However the end result does seem to handle the .NET installation nicely. | I haven’t programmed in Pascal, and this was my first shot at an Inno Setup script, so there are probably plenty of opportunities for tidying things up. A lot of what I did was just copying and modifying stuff. However the end result does seem to handle the .NET installation nicely. | ||
Line 39: | Line 39: | ||
Notes: | Notes: | ||
- | | + | * The script is based on .NET Framework 1.1 but changes for other versions should be simple. |
- | The best way to check whether the .NET Framework is installed seems to be registry key ‘HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\policy\v1.1′. This key is accessible to regular users. | + | |
- | If the .NET Framework download or installation fails or is cancelled, the installation goes back to the Ready to Install page. The user can restart the install, or cancel it. | + | |
- | The URL for the .NET Framework download is hard coded. If it changes a new setup will be required. However it seems to be referenced in many places around the Internet, so hopefully Microsoft will think twice before changing it (famous last words…). | + | |
- | If the user cancels the .NET Framework download partway through, then restarts the installation, | + | |
- | I have not tried to make the .NET install silent - I felt it was better to let the user see what is going on. The process can take a while. | + | |
Unrelated but perhaps useful information | Unrelated but perhaps useful information | ||
Line 55: | Line 55: | ||
Root: HKCR; Subkey: “.jpg\OpenWithList\MyApp.exe”; | Root: HKCR; Subkey: “.jpg\OpenWithList\MyApp.exe”; | ||
Root: HKCR; Subkey: “.jpeg\OpenWithList\MyApp.exe”; | Root: HKCR; Subkey: “.jpeg\OpenWithList\MyApp.exe”; | ||
- | Root: HKCR; Subkey: “applications\MyApp.exe\shell\open\command”; | + | Root: HKCR; Subkey: “applications\MyApp.exe\shell\open\command”; |
+ | | ||
Root: HKCU; Subkey: " | Root: HKCU; Subkey: " | ||
Root: HKCU; Subkey: " | Root: HKCU; Subkey: " | ||
- | Root: HKCU; Subkey: " | + | Root: HKCU; Subkey: " |
+ | | ||
</ | </ | ||
The HKCR values install the “Open With” option for all users, but fail if the user is not an administrator. The HKCU values install it for the current user, and work even if the user is not an administrator. | The HKCR values install the “Open With” option for all users, but fail if the user is not an administrator. The HKCU values install it for the current user, and work even if the user is not an administrator. | ||
- | VMWare | + | ** VMWare |
I used VMWare Workstation for the first time in testing the setup process, and I have to say it is a huge productivity booster for this type of thing. Using snapshots I was able to run the installation process with minor changes in various configurations over and over again - probably about 20 times in a couple of hours. It was a huge productivity gain, and I join those who say that VMWare or an equivalent product is an essential tool for software development. | I used VMWare Workstation for the first time in testing the setup process, and I have to say it is a huge productivity booster for this type of thing. Using snapshots I was able to run the installation process with minor changes in various configurations over and over again - probably about 20 times in a couple of hours. It was a huge productivity gain, and I join those who say that VMWare or an equivalent product is an essential tool for software development. | ||
- | Script: | + | ** Script: |
<code inno> | <code inno> | ||
[_ISTool] | [_ISTool] | ||
Line 107: | Line 109: | ||
function isxdl_SetOption(Option, | function isxdl_SetOption(Option, | ||
external ' | external ' | ||
- | |||
const | const | ||
Line 115: | Line 116: | ||
function InitializeSetup(): | function InitializeSetup(): | ||
- | |||
begin | begin | ||
Result := true; | Result := true; | ||
Line 158: | Line 158: | ||
isxdl_SetOption(' | isxdl_SetOption(' | ||
- | isxdl_SetOption(' | + | isxdl_SetOption(' |
+ | ' | ||
if isxdl_DownloadFiles(hWnd) = 0 then Result := false; | if isxdl_DownloadFiles(hWnd) = 0 then Result := false; | ||
end; | end; | ||
Line 175: | Line 176: | ||
end; | end; | ||
- | function UpdateReadyMemo(Space, | + | function UpdateReadyMemo(Space, |
+ | | ||
var | var | ||
s: string; | s: string; | ||
begin | begin | ||
- | if memoDependenciesNeeded <> '' | + | if memoDependenciesNeeded <> '' |
+ | | ||
+ | end; | ||
s := s + MemoDirInfo + NewLine + NewLine; | s := s + MemoDirInfo + NewLine + NewLine; | ||
Line 187: | Line 191: | ||
</ | </ | ||
- | === Tips === | + | == Detecting .NET 4.0 Framework & Installing It If Missing |
- | ==== Restart Computer | + | |
- | When an installer, after its installation, | + | === Method 1 === |
+ | Source: http:// | ||
+ | |||
+ | <code inno> | ||
+ | [CustomMessages] | ||
+ | dotnetmissing=This application requires Microsoft Framework 4.0 which is not yet installed on this computer. Would you like to download it now? | ||
+ | |||
+ | . . . | ||
+ | |||
+ | [Code] | ||
+ | function InitializeSetup(): | ||
+ | var | ||
+ | ErrorCode: Integer; | ||
+ | netFrameWorkInstalled : Boolean; | ||
+ | isInstalled: | ||
+ | begin | ||
+ | result := true; | ||
+ | |||
+ | // Check for the .Net 4.0 framework | ||
+ | isInstalled := 0; | ||
+ | netFrameworkInstalled := RegQueryDWordValue(HKLM, | ||
+ | if ((netFrameworkInstalled) and (isInstalled <> 1)) then begin | ||
+ | netFrameworkInstalled := false; | ||
+ | end; | ||
+ | |||
+ | if netFrameworkInstalled = false then begin | ||
+ | if (MsgBox(ExpandConstant(' | ||
+ | begin | ||
+ | ShellExec(' | ||
+ | ' | ||
+ | '','', | ||
+ | end; | ||
+ | result := false; | ||
+ | end; | ||
+ | |||
+ | end; | ||
+ | </ | ||
+ | |||
+ | === Method 2 === | ||
+ | Source: http:// | ||
+ | |||
+ | This code checks, downloads and installs it if needed. Verify the file '' | ||
+ | |||
+ | <code inno> | ||
+ | [CustomMessages] | ||
+ | dotnetfx40_title=.NET Framework 4.0 | ||
+ | dotnetfx40_size=48.1 MB | ||
+ | |||
+ | . . . | ||
+ | |||
+ | [Code] | ||
+ | const | ||
+ | dotnetfx40_url = ' | ||
+ | |||
+ | procedure dotnetfx40(); | ||
+ | var | ||
+ | version: cardinal; | ||
+ | begin | ||
+ | RegQueryDWordValue(HKLM, | ||
+ | if version <> 1 then begin | ||
+ | AddProduct(' | ||
+ | '/q / | ||
+ | CustomMessage(' | ||
+ | CustomMessage(' | ||
+ | dotnetfx40_url); | ||
+ | end; | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | == Installer Tips == | ||
+ | === Restart Computer === | ||
+ | When an installer, after its installation, | ||
< | < | ||
- | ==== Blue Screen of Death ==== | + | === Blue Screen of Death === |
Issue: A "Blue Screen of Death" shows up when trying to start the installer. | Issue: A "Blue Screen of Death" shows up when trying to start the installer. | ||
> He starts the setup and a a random point it gets killed (not an normal stop).... | > He starts the setup and a a random point it gets killed (not an normal stop).... | ||
Line 203: | Line 278: | ||
------------------------------------------------------------------ | ------------------------------------------------------------------ | ||
- | ===== How To Do A Clean Boot Using the System Configuration Utility | + | ==== How To Do A Clean Boot Using the System Configuration Utility ==== |
- | 1. Click " | + | # |
- | 2. In " | + | # In " |
- | 3. Click " | + | # Click " |
- | 4. Click " | + | # Click " |
- | 5. Click " | + | # Click " |
- | 6. Click " | + | # Click " |
- | 7. Restart computer | + | # Restart computer |
- | 8. Insert the < | + | # Insert the < |
When the installation is complete you must restore your computer from a clean boot. | When the installation is complete you must restore your computer from a clean boot. | ||
- | 1. Click " | + | # |
- | Note: you can choose to do the following steps or just click " | + | # In " |
- | 2. In " | + | # Click " |
- | 3. Click " | + | # Click " |
- | 4. Click " | + | # Click " |
- | 5. Click " | + | # Restart computer |
- | 6. Restart computer | + | |
------------------------------------------------------------------ | ------------------------------------------------------------------ | ||
Line 230: | Line 304: | ||
> With a customer we run in to the following problem. | > With a customer we run in to the following problem. | ||
> | > | ||
- | > He starts the setup and a a random point it gets killed (not an normal | + | > He starts the setup and at a random point it gets killed (not an normal |
> stop).... | > stop).... | ||
> | > | ||
- | > Weh I use the /LOG option the log also just stops at a point en no | + | > When I use the /LOG option, the log also just stops at a point and no |
- | > closing/ | + | > closing/ |
- | > folders are still there. This suggest that (probebly | + | > folders are still there. This suggest that (probably |
> aka virusscanner) is killing the installer process... | > aka virusscanner) is killing the installer process... | ||
+ | == Plugin: File Downloader IDP == | ||
+ | |||
+ | * Download: [[https:// | ||
+ | * Uses: FTP, HTTP and HTTPS protocols | ||
+ | |||
+ | Example: | ||
+ | <code inno> | ||
+ | #include < | ||
+ | |||
+ | [Files] | ||
+ | Source: " | ||
+ | Source: " | ||
+ | Source: " | ||
+ | |||
+ | [Icons] | ||
+ | Name: " | ||
+ | |||
+ | [Code] | ||
+ | procedure InitializeWizard(); | ||
+ | begin | ||
+ | idpAddFileSize(' | ||
+ | idpAddFileSize(' | ||
+ | idpAddFileSize(' | ||
+ | |||
+ | idpDownloadAfter(wpReady); | ||
+ | end. | ||
+ | </ |