|
|
It would probably be a good idea to use that article, if the SOFTWARE\Microsoft\NET Framework Setup\NDP\* keys aren't safe. I haven't run into problem with them myself, but that doesn't mean they don't have any.
A problem for me is, that I have made my own .Net (and other apps) detector / downloader / installer, which works for the whole .Net family, and the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\* keys described in the article you refer to, don't support .Net 3.0, .Net 3.0 SP1 or .Net 3.5, but the SOFTWARE\Microsoft\NET Framework Setup\NDP\* keys do...
What to do about those...
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
I also have the same problem(intsalled and then uninstalled on same machine and still the "Policy" kys exists). Even in the post I saw the same keys!!
which other keys you mean to say for this problem.
|
|
|
|
|
First thank you for this great setup script.
I would need also a version for a .NET Framework 3.5 application. How can I check on .NET 3.5?
This should be probably even easier, because .NET Framework 3.5 seems to work only on Windows XP/Vista/2003/2008. Therefore there should not be that many dependencies anymore. Does someone has an idea on that?
Thank you very much in advance
Andreas
http://www.ab-tools.com/English/[^]
|
|
|
|
|
First of all - thanks for a great Inno add-on!
I seem to miss a language translation possibility, for the download Window. I guess you make that window in your isxdl.dll, so I don't know how much work it would be, to make that window translateable. It just looks silly, when all the other windows i my installer is in danish, and then this one download window is in english.
Could you please include .Net 2.0 SP1 also? My .Net 2.0 application requires it you see
Link to .Net 2.0 SP1
Is your isxdl.dll secret, or could I have the sourcecode, so I could make the additions myself?
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
Nevermind on the SP1 question. I found out how to do it via the provided script code. Actually made myself a .Net 3.5 version which runs like a dream
I still have the language issue in the download window though.
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
Hello spif2001,
I saw you've wrote that you've made a .NET 3.5 version.
That would be exactly what I'd need for my application, too.
It would be really great if you could post your code changes done for using it with .NET 3.5.
Thank you very much in advance
Andreas
http://www.ab-tools.com/English/[^]
|
|
|
|
|
Sure - but I have moved a lot of things around. Hope you can figure it out.
I have made it so, that any new application installer I make, have to have some ekstra includes. Heres an example of a Test Installer's main iss file:
#define ApplicationName "DotNetTest"
#include "C:\Inno Installers\Common Inno Files\CustomLanguage\CustomLanguage.iss"
#include "C:\Inno Installers\Common Inno Files\ISXDL\isxdl.iss"
#include "C:\Inno Installers\Common Inno Files\Defines\Defines.iss"
#include "C:\Inno Installers\Common Inno Files\DotNet 3.5\DotNet35.iss"
[Setup]
AppName=TestDotNet35
AppVerName=TestDotNet35 v1.0
DefaultDirName=C:\TestDotNet35
DefaultGroupName=TestDotNet35
OutputBaseFilename=TestDotNet35 v1.0
OutputDir=C:\Inno Installers\Test installers\Compiled tests
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
[Files]
Source: C:\some.exe; DestDir: {app};
[UninstallDelete]
Type: filesandordirs; Name: {app}
I have a rather large hierarchy of iss files, because I love to reuse code.
Just as in this article's installer, I include the ISXDL.iss file.
All language specific messages I have in a CustomLanguage.iss file which looks like this:
#include "C:\Inno Installers\Common Inno Files\CustomLanguage\English\CustomEnglish.iss"
#include "C:\Inno Installers\Common Inno Files\CustomLanguage\German\CustomGerman.iss"
#include "C:\Inno Installers\Common Inno Files\CustomLanguage\Danish\CustomDanish.iss"
#include "C:\Inno Installers\Common Inno Files\CustomLanguage\Swedish\CustomSwedish.iss"
[Languages]
;Name: english; MessagesFile: compiler:Default.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\English\{#ApplicationName} license\English.txt
;Name: german; MessagesFile: compiler:Languages\German.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\German\{#ApplicationName} license\German.txt
;Name: danish; MessagesFile: compiler:Languages\Danish.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\Danish\{#ApplicationName} license\Danish.txt
;Name: swedish; MessagesFile: compiler:Languages\Swedish.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\Swedish\{#ApplicationName} license\Swedish.txt
Name: english; MessagesFile: compiler:Default.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\English\General License.rtf
Name: german; MessagesFile: compiler:Languages\German.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\German\General License.rtf
Name: danish; MessagesFile: compiler:Languages\Danish.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\Danish\General License.rtf
Name: swedish; MessagesFile: compiler:Languages\Swedish.isl; LicenseFile: C:\Inno Installers\Common Inno Files\CustomLanguage\Swedish\General License.rtf
[CustomMessages]
DependenciesDir=Prerequisites
MSI20Title=Windows Installer 2.0
MSI31Title=Windows Installer 3.1
IE6Title=Internet Explorer 6
MDACTitle=MDAC 2.8
DOTNET20Title=Microsoft .NET Framework 2.0
DOTNET20SP1Title=Microsoft .NET Framework 2.0 Service Pack 1
DOTNET35Title=Microsoft .NET Framework 3.5
SqlExpress2005SP2Title=Microsoft SQL Server 2005 Express Edition Service Pack 2
Sql2005XMOTitle=Microsoft SQL Server 2005 Management Objects Collection
This language file includes country specific language iss files, where the english version looks like this:
[CustomMessages]
english.Install_CloseRunningProgram=An instance of {#ApplicationName} is already running. Please close the running {#ApplicationName} application and run {#ApplicationName} Setup again.
english.Uninstall_CloseRunningProgram=An instance of {#ApplicationName} is running. Please close the running {#ApplicationName} application and try uninstalling {#ApplicationName} again.
english.OldUninstall_1={#ApplicationName} Setup found an old {#ApplicationName} program on the system, which MUST be removed before this installation can continue.
english.OldUninstall_2=Do you wish to remove this old {#ApplicationName} program now?
english.OldUninstallFail=Could not uninstall the old {#ApplicationName} installation! Please uninstall {#ApplicationName} via Add/Remove programs in the Control Panel.
english.InstallFor=Install {#ApplicationName} for:
english.Everyone=Everyone
english.JustMe=Just me
english.DependenciesDownloadTitle=Download Dependencies
english.DependenciesInstallTitle=Install Dependencies
english.Win2000Sp3Msg=Windows 2000 Service Pack 3 must be installed before {#ApplicationName} Setup can continue. Please install Windows 2000 Service Pack 3 and run {#ApplicationName} Setup again.
english.WinXPSp2Msg=Windows XP Service Pack 2 must be installed before {#ApplicationName} Setup can continue. Please install Windows XP Service Pack 2 and run {#ApplicationName} Setup again.
english.SqlExpressSP2Msg={#ApplicationName} Setup could not find a Microsoft SQL Server on the computer.%n%nDo you wish to install Microsoft SQL Server 2005 Express Edition Service Pack 2 during the {#ApplicationName} installation?
english.DownloadMsg1=The following applications are required before {#ApplicationName} Setup can continue:
english.DownloadMsg2=Download and install now?
english.SqlExpress2005SP2DownloadSize=~37.5 MB
english.Sql2005XMODownloadSize=~9.2 MB
english.MSI20DownloadSize=~1.7 MB
english.MSI31DownloadSize=~2.5 MB
english.IE6DownloadSize=~46 MB
english.MDACDownloadSize=~5.4 MB
english.DOTNET20DownloadSize=~23 MB
english.DOTNET20SP1DownloadSize=~23.5 MB
english.DOTNET35DownloadSize=~200 MB
english.SqlExpress2005SP2InstallMsg=Installing Microsoft SQL Server 2005 Express Edition Service Pack 2... (May take a few minutes)
english.Sql2005XMOInstallMsg=Installing Microsoft SQL Server 2005 Management Objects Collection... (May take a few minutes)
english.MSI20InstallMsg=Installing Windows Installer 2.0... (May take a few minutes)
english.MSI31InstallMsg=Installing Windows Installer 3.1... (May take a few minutes)
english.IE6InstallMsg=Installing Internet Explorer 6... (May take a few minutes)
english.DOTNET20InstallMsg=Installing Microsoft .NET Framework 2.0... (May take a few minutes)
english.DOTNET20SP1InstallMsg=Installing Microsoft .NET Framework 2.0 Service Pack 1... (May take a few minutes)
english.DOTNET35InstallMsg=Installing Microsoft .NET Framework 3.5... (May take a few minutes)
I also have a defines.iss file with my URL's in looking like this
#define MSI20URL "'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe'"
#define MSI31URL "'http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe'"
#define IE6URL "'http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/ie6setup.exe'"
#define DotNet11URL "'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe'"
#define DotNet20URL "'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe'"
#define DotNet20SP1URL "'***Placed on local server***'"
#define DotNet35URL "'http://download.microsoft.com/download/6/0/f/60fc5854-3cb8-4892-b6db-bd4f42510f28/dotnetfx35.exe'"
#define SQLExpress2005SP2URL "'http://go.microsoft.com/fwlink/?LinkId=65212'"
#define SQL2005XMOURL "'http://download.microsoft.com/download/4/4/D/44DBDE61-B385-4FC2-A67D-48053B8F9FAD/SQLServer2005_XMO.msi'"
...and finally the dotnet35.iss file which was your primary interest:
[Run]
Filename: {ini:{tmp}\dep.ini,install,msi31}; Description: {cm:MSI31Title}; StatusMsg: {cm:MSI31InstallMsg}; Parameters: "/quiet"; Flags: skipifdoesntexist
Filename: {ini:{tmp}\dep.ini,install,dotnet35}; Description: {cm:DOTNET35Title}; StatusMsg: {cm:DOTNET35InstallMsg}; Parameters: "/Q /T:{tmp}\dotnetfx35 /C:""install /qb"""; Flags: skipifdoesntexist
[Code]
var
dotnet35Path, msi31Path, neededDependenciesDownloadMemo, neededDependenciesInstallMemo, neededDependenciesDownloadMsg: string;
downloadNeeded: boolean;
procedure DecodeVersion(const Version: cardinal; var a, b : word);
begin
a := word(Version shr 16);
b := word(Version and not $ffff0000);
end;
function IsMinMSIAvailable(HV:Integer; NV:Integer ): boolean;
var
Version, dummy : cardinal;
MsiHiVer, MsiLoVer : word;
begin
Result:=(FileExists(ExpandConstant('{sys}\msi.dll'))) and (GetVersionNumbers(ExpandConstant('{sys}\msi.dll'), Version, dummy));
DecodeVersion(Version, MsiHiVer, MsiLoVer);
Result:= (Result) and (MsiHiVer >= HV) and (MsiLoVer >= NV);
end;
function InitializeSetup(): Boolean;
var
WindowsVersion: TWindowsVersion;
begin
if not WizardSilent() then begin
GetWindowsVersionEx(WindowsVersion);
Result := true;
if WindowsVersion.NTPlatform and (WindowsVersion.Major = 5) and (WindowsVersion.Minor = 1) and (WindowsVersion.ServicePackMajor < 2) then begin
MsgBox(CustomMessage('WinXPSp2Msg'), mbError, MB_OK);
Result := false;
exit;
end;
if WindowsVersion.NTPlatform and (WindowsVersion.Major >= 5) and (not IsMinMSIAvailable(3,0)) then begin
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('MSI31Title') + #13;
msi31Path := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\WindowsInstaller-KB893803-v2-x86.exe';
if not FileExists(msi31Path) then begin
msi31Path := ExpandConstant('{tmp}\msi31.exe');
if not FileExists(msi31Path) then begin
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('MSI31Title') + #13;
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('MSI31Title') + ' (' + CustomMessage('MSI31DownloadSize') + ')' + #13;
isxdl_AddFile({#MSI31URL}, msi31Path);
downloadNeeded := true;
end;
end;
SetIniString('install', 'msi31', msi31Path, ExpandConstant('{tmp}\dep.ini'));
end;
// Check for required dotnetfx 3.5 installation
if (not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5')) then begin
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('DOTNET35Title') + #13;
dotnet35Path := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\dotnetfx35.exe';
if not FileExists(dotnet35Path) then begin
dotnet35Path := ExpandConstant('{tmp}\dotnetfx35.exe');
if not FileExists(dotnet35Path) then begin
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('DOTNET35Title') + #13;
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('DOTNET35Title') + ' (' + CustomMessage('DOTNET35DownloadSize') + ')' + #13;
isxdl_AddFile({#DotNet35URL}, dotnet35Path);
downloadNeeded := true;
end;
end;
SetIniString('install', 'dotnet35', dotnet35Path, ExpandConstant('{tmp}\dep.ini'));
end;
end;
end;
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
begin
Result := true;
if CurPage = wpReady then begin
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
if downloadNeeded then
if MsgBox(CustomMessage('DownloadMsg1') + #13 + neededDependenciesDownloadMsg + #13 + CustomMessage('DownloadMsg2'), mbConfirmation, MB_YESNO) = IDNO then Result := false
else if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
end;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
s: string;
begin
if neededDependenciesDownloadMemo <> '' then s := s + CustomMessage('DependenciesDownloadTitle') + ':' + NewLine + neededDependenciesDownloadMemo + NewLine;
if neededDependenciesInstallMemo <> '' then s := s + CustomMessage('DependenciesInstallTitle') + ':' + NewLine + neededDependenciesInstallMemo + NewLine;
s := s + MemoDirInfo + NewLine + NewLine + MemoGroupInfo
if MemoTasksInfo <> '' then s := s + NewLine + NewLine + MemoTasksInfo;
Result := s
end;
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
modified on Thursday, May 29, 2008 10:56 AM
|
|
|
|
|
Hello spif2001,
first thank you for your fast answer.
Did you test your installer on a fresh XP installation already?
Only because I've also played around a little bit with that now and see two problems in your code:
1. .NET Framework 3.5 does need .NET Framework 1.x or 2.x to be installed first. Otherwise installer will fail (on a fresh XP - also with SP2 - .NET is not installed at all).
2. the .NET Framework 3.5 installer needs Windows installer 3.1 (yes, "3.1", "3.0" is not enough - coundn't believe that myself first ).
Both are no bigger problems, but should be considered.
Best regards
Andreas
http://www.ab-downloads.com[^]
|
|
|
|
|
1. Dotnetfx35 installs .Net 2.0 SP1 and .Net 3.0 as well as .Net 3.5.
2. Although it is called Windows Installer 3.0 it is actually the 3.1 installer - some MS naming issue, but if you look closer at my code, you can see it is the 3.1 that gets installed.
I have tried to install it many times on a fresh XP SP2 with no .Net at all and it works fine.
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
Hello spif2001,
1. strange, last time I tried the installer doesn't worked without installing .NET 2.0 first. But you're right, I can't reproduce this problem anymore. Therefore it had to be my fault. Sorry, forget this.
2. yes, I saw you're installing MSI 3.1 and that's correct, of course. But you check on version <3.0 and that's the problem. You should check on version <3.1, because on a clean Windows XP with SP2 exactly version 3.0 is installed and therefore the installer would not install version 3.1 in this case (which leads to an error when trying to install .NET 3.5 in next step).
Best regards
Andreas
http://www.ab-tools.com/English/[^]
|
|
|
|
|
2. You are probably right, and I am now unsure as to wether I tested the Windows Installer part or not. The .Net part definitely works.
I'll try it tomorrow and see how it goes. If you are right, I'll update the above code. We can't have incorrect code lying around in here now can we?
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
I struggled the whole day yesterday with a vs2005 Setup and Deployment project just to have my app start AFTER the install was over, not during. I failed. Luckily I found InnoSetup and ISTool, and then this great article that would take care of my last setup problem: prerequisites:
So if I understand, to my existing iss script, I have to add to top and botton portion found in Setup.iss. I also see that you have an #include "isxdl.iss" which points to a dll.
Would it be possible to use an #include type process to move everything prerequisite a different file?
This would make my Setup1.iss just focused on the specifics of my App1.
Thanks
|
|
|
|
|
Message Closed
modified 23-Dec-20 12:46pm.
|
|
|
|
|
that was simple, and it shows what a great scripting engine Inno setup is:
Create a file called prerequisites.iss in the same folder as YourApp.iss, isxdl.iss and isxdl.dll:
<br />
#include "isxdl.iss"<br />
<br />
[CustomMessages]<br />
;configurations<br />
AppName=MyProgram<br />
DependenciesDir=MyProgramDependencies<br />
<br />
MSI20Title=Windows Installer 2.0<br />
MSI31Title=Windows Installer 3.1<br />
IE6Title=Internet Explorer 6<br />
MDACTitle=MDAC 2.8<br />
JETTitle=JET 4<br />
DOTNET20Title=Microsoft .NET Framework 2.0<br />
<br />
;memos<br />
en.DependenciesDownloadTitle=Download Dependencies<br />
de.DependenciesDownloadTitle=Abhängigkeiten herunterladen<br />
<br />
en.DependenciesInstallTitle=Install Dependencies<br />
de.DependenciesInstallTitle=Abhängigkeiten installieren<br />
<br />
;messages<br />
en.Win2000Sp3Msg=Windows 2000 Service Pack 3 must be installed before setup can continue. Please install Windows 2000 Service Pack 3 and run Setup again.<br />
de.Win2000Sp3Msg=Windows 2000 Service Pack 3 muss installiert werden bevor das Setup fortfahren kann. Bitte installieren Sie Windows 2000 Service Pack 3 und starten Sie das Setup erneut.<br />
<br />
en.WinXPSp2Msg=Windows XP Service Pack 2 must be installed before setup can continue. Please install Windows XP Service Pack 2 and run Setup again.<br />
de.WinXPSp2Msg=Windows XP Service Pack 2 muss installiert werden bevor das Setup fortfahren kann. Bitte installieren Sie Windows XP Service Pack 2 und starten Sie das Setup erneut.<br />
<br />
;en.IISMsg=Microsoft IIS must be installed before setup can continue. Please install Microsoft IIS and run Setup again.<br />
;de.IISMsg=Microsoft IIS muss installiert werden bevor das Setup fortfahren kann. Bitte installieren Sie Microsoft ISS und starten Sie das Setup erneut.<br />
<br />
en.DownloadMsg1=The following applications are required before setup can continue:<br />
de.DownloadMsg1=Die folgenden Programme werden benötigt bevor das Setup fortfahren kann:<br />
<br />
en.DownloadMsg2=Download and install now?<br />
de.DownloadMsg2=Jetzt downloaden und installieren?<br />
<br />
;install text<br />
en.MSI20DownloadSize=~1.7 MB<br />
en.MSI31DownloadSize=~2.5 MB<br />
en.IE6DownloadSize=~46 MB<br />
en.MDACDownloadSize=~5.4 MB<br />
en.JETDownloadSize=~3.7 MB<br />
en.DOTNET20DownloadSize=~23 MB<br />
<br />
de.MSI20DownloadSize=~1,7 MB<br />
de.MSI31DownloadSize=~2,5 MB<br />
de.IE6DownloadSize=~46 MB<br />
de.MDACDownloadSize=~5,4 MB<br />
de.JETDownloadSize=~3,7 MB<br />
de.DOTNET20DownloadSize=~23 MB<br />
<br />
<br />
en.MSI20InstallMsg=Installing Windows Installer 2.0... (May take a few minutes)<br />
de.MSI20InstallMsg=Installiere Windows Installer 2.0... (Kann einige Minuten dauern)<br />
<br />
en.MSI31InstallMsg=Installing Windows Installer 3.1... (This may take a few minutes)<br />
de.MSI31InstallMsg=Installiere Windows Installer 3.1... (Kann einige Minuten dauern)<br />
<br />
en.IE6InstallMsg=Installing Internet Explorer 6... (May take a few minutes)<br />
de.IE6InstallMsg=Installiere Internet Explorer 6... (Kann einige Minuten dauern)<br />
<br />
en.MDACInstallMsg=Installing MDAC 2.8... (May take a few minutes)<br />
de.MDACInstallMsg=Installiere MDAC 2.8... (Kann einige Minuten dauern)<br />
<br />
en.JETInstallMsg=Installing JET 4... (May take a few minutes)<br />
de.JETInstallMsg=Installiere JET 4... (Kann einige Minuten dauern)<br />
<br />
en.DOTNET20InstallMsg=Installing Microsoft .NET Framework 2.0... (May take a few minutes)<br />
de.DOTNET20InstallMsg=Installiere Microsoft .NET Framework 2.0... (Kann einige Minuten dauern)<br />
<br />
<br />
[Run]<br />
Filename: {ini:{tmp}\dep.ini,install,msi20}; Description: {cm:MSI20Title}; StatusMsg: {cm:MSI20InstallMsg}; Parameters: "/q"; Flags: skipifdoesntexist<br />
Filename: {ini:{tmp}\dep.ini,install,msi31}; Description: {cm:MSI31Title}; StatusMsg: {cm:MSI31InstallMsg}; Parameters: "/quiet"; Flags: skipifdoesntexist<br />
<br />
Filename: {ini:{tmp}\dep.ini,install,ie}; Description: {cm:IE6Title}; StatusMsg: {cm:IE6InstallMsg}; Parameters: "/Q /C:""ie6wzd /QU /R:N /S:#e"""; Flags: skipifdoesntexist<br />
<br />
Filename: {ini:{tmp}\dep.ini,install,mdac}; Description: {cm:MDACTitle}; StatusMsg: {cm:MDACInstallMsg}; Parameters: "/Q /C:""setup /QNT"""; Flags: skipifdoesntexist<br />
Filename: {ini:{tmp}\dep.ini,install,jet}; Description: {cm:JETTitle}; StatusMsg: {cm:JETInstallMsg}; Parameters: /Q; Flags: skipifdoesntexist<br />
<br />
Filename: {ini:{tmp}\dep.ini,install,dotnet20}; Description: {cm:DOTNET20Title}; StatusMsg: {cm:DOTNET20InstallMsg}; Parameters: "/Q /T:{tmp}\dotnetfx /C:""install /q"""; Flags: skipifdoesntexist<br />
<br />
<br />
[Code]<br />
var<br />
iePath, mdacPath, jetPath, dotnet20Path, msi31Path, msi20Path: string;<br />
downloadNeeded: boolean;<br />
neededDependenciesDownloadMemo: string;<br />
neededDependenciesInstallMemo: string;<br />
neededDependenciesDownloadMsg: string;<br />
<br />
const<br />
msi20URL = 'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe';<br />
msi31URL = 'http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe';<br />
mdacURL = 'http://download.microsoft.com/download/c/d/f/cdfd58f1-3973-4c51-8851-49ae3777586f/MDAC_TYP.EXE';<br />
jetURL = 'http://download.microsoft.com/download/4/3/9/4393c9ac-e69e-458d-9f6d-2fe191c51469/Jet40SP8_9xNT.exe';<br />
ieURL = 'http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/ie6setup.exe';<br />
dotnet20URL = 'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe';<br />
<br />
procedure DecodeVersion(const Version: cardinal; var a, b : word);<br />
begin<br />
a := word(Version shr 16);<br />
b := word(Version and not $ffff0000);<br />
end;<br />
<br />
function IsMinMSIAvailable(HV:Integer; NV:Integer ): boolean;<br />
var Version, dummy : cardinal;<br />
MsiHiVer, MsiLoVer : word;<br />
<br />
begin<br />
Result:=(FileExists(ExpandConstant('{sys}\msi.dll'))) and<br />
(GetVersionNumbers(ExpandConstant('{sys}\msi.dll'), Version, dummy));<br />
DecodeVersion(Version, MsiHiVer, MsiLoVer);<br />
Result:= (Result) and (MsiHiVer >= HV) and (MsiLoVer >= NV);<br />
end;<br />
<br />
function InitializeSetup(): Boolean;<br />
var<br />
SoftwareVersion: string;<br />
WindowsVersion: TWindowsVersion;<br />
<br />
begin<br />
GetWindowsVersionEx(WindowsVersion);<br />
Result := true;<br />
<br />
if WindowsVersion.NTPlatform and<br />
(WindowsVersion.Major = 5) and<br />
(WindowsVersion.Minor = 0) and<br />
(WindowsVersion.ServicePackMajor < 3) then<br />
begin<br />
MsgBox(CustomMessage('Win2000Sp3Msg'), mbError, MB_OK);<br />
Result := false;<br />
exit;<br />
end;<br />
<br />
if WindowsVersion.NTPlatform and<br />
(WindowsVersion.Major = 5) and<br />
(WindowsVersion.Minor = 1) and<br />
(WindowsVersion.ServicePackMajor < 2) then<br />
begin<br />
MsgBox(CustomMessage('WinXPSp2Msg'), mbError, MB_OK);<br />
Result := false;<br />
exit;<br />
end;<br />
<br />
<br />
if (not WindowsVersion.NTPlatform) and<br />
(WindowsVersion.Major >= 4) and<br />
(WindowsVersion.Minor >= 1) and<br />
(not IsMinMSIAvailable(2,0)) then<br />
begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('MSI20Title') + #13;<br />
msi20Path := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\instmsia.exe';<br />
if not FileExists(msi20Path) then begin<br />
msi20Path := ExpandConstant('{tmp}\msi20.exe');<br />
if not FileExists(msi20Path) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('MSI20Title') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('MSI20Title') + ' (' + CustomMessage('MSI20DownloadSize') + ')' + #13;<br />
isxdl_AddFile(msi20URL, msi20Path);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'msi20', msi20Path, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
<br />
// Check for required Windows Installer 3.0 on Windows 2000, XP, Server 2003, Vista or higher<br />
if WindowsVersion.NTPlatform and<br />
(WindowsVersion.Major >= 5) and<br />
(not IsMinMSIAvailable(3,0)) then<br />
begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('MSI31Title') + #13;<br />
msi31Path := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\WindowsInstaller-KB893803-v2-x86.exe';<br />
if not FileExists(msi31Path) then begin<br />
msi31Path := ExpandConstant('{tmp}\msi31.exe');<br />
if not FileExists(msi31Path) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('MSI31Title') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('MSI31Title') + ' (' + CustomMessage('MSI31DownloadSize') + ')' + #13;<br />
isxdl_AddFile(msi31URL, msi31Path);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'msi31', msi31Path, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
<br />
// Check for required Internet Explorer installation<br />
// Note that if Internet Explorer 6 is downloaded, the express setup will be downloaded, however it is the same<br />
// ie6setup.exe that would be available in the ie6 folder. The only difference is that the<br />
// user will be presented with an option as to where to download Internet Explorer 6 and a progress dialog.<br />
// Most common components will still be installed automatically.<br />
SoftwareVersion := '';<br />
RegQueryStringValue(HKLM, 'Software\Microsoft\Internet Explorer', 'Version', SoftwareVersion);<br />
if (SoftwareVersion < '5') then begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('IE6Title') + #13;<br />
iePath := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\ie6\ie6setup.exe';<br />
if not FileExists(iePath) then begin<br />
iePath := ExpandConstant('{tmp}\ie6setup.exe');<br />
if not FileExists(iePath) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('IE6Title') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('IE6Title') + ' (' + CustomMessage('IE6DownloadSize') + ')' + #13;<br />
isxdl_AddFile(ieURL, iePath);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'ie', iePath, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
<br />
// Check for required MDAC installation<br />
SoftwareVersion := '';<br />
RegQueryStringValue(HKLM, 'Software\Microsoft\DataAccess', 'FullInstallVer', SoftwareVersion);<br />
if (SoftwareVersion < '2.7') then begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('MDACTitle') + #13;<br />
mdacPath := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\MDAC_TYP.EXE';<br />
if not FileExists(mdacPath) then begin<br />
mdacPath := ExpandConstant('{tmp}\MDAC_TYP.EXE');<br />
if not FileExists(mdacPath) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('MDACTitle') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('MDACTitle') + ' (' + CustomMessage('MDACDownloadSize') + ')' + #13;<br />
isxdl_AddFile(mdacURL, mdacPath);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'mdac', mdacPath, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
<br />
// Check for required Jet installation<br />
if (not RegKeyExists(HKLM, 'Software\Microsoft\Jet\4.0')) then begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('JETTitle') + #13;<br />
jetPath := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\Jet40SP8_9xNT.exe';<br />
if not FileExists(jetPath) then begin<br />
jetPath := ExpandConstant('{tmp}\Jet40SP8_9xNT.exe');<br />
if not FileExists(jetPath) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('JETTitle') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('JETTitle') + ' (' + CustomMessage('JETDownloadSize') + ')' + #13;<br />
isxdl_AddFile(jetURL, jetPath);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'jet', jetPath, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
<br />
// Check for required dotnetfx 2.0 installation<br />
if (not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727')) then begin<br />
neededDependenciesInstallMemo := neededDependenciesInstallMemo + ' ' + CustomMessage('DOTNET20Title') + #13;<br />
dotnet20Path := ExpandConstant('{src}') + '\' + CustomMessage('DependenciesDir') + '\dotnetfx.exe';<br />
if not FileExists(dotnet20Path) then begin<br />
dotnet20Path := ExpandConstant('{tmp}\dotnetfx.exe');<br />
if not FileExists(dotnet20Path) then begin<br />
neededDependenciesDownloadMemo := neededDependenciesDownloadMemo + ' ' + CustomMessage('DOTNET20Title') + #13;<br />
neededDependenciesDownloadMsg := neededDependenciesDownloadMsg + CustomMessage('DOTNET20Title') + ' (' + CustomMessage('DOTNET20DownloadSize') + ')' + #13;<br />
isxdl_AddFile(dotnet20URL, dotnet20Path);<br />
downloadNeeded := true;<br />
end;<br />
end;<br />
SetIniString('install', 'dotnet20', dotnet20Path, ExpandConstant('{tmp}\dep.ini'));<br />
end;<br />
end;<br />
<br />
<br />
function NextButtonClick(CurPage: Integer): Boolean;<br />
var<br />
hWnd: Integer;<br />
<br />
begin<br />
Result := true;<br />
<br />
if CurPage = wpReady then begin<br />
<br />
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));<br />
<br />
if downloadNeeded then<br />
if MsgBox(CustomMessage('DownloadMsg1') + #13 + neededDependenciesDownloadMsg + #13 + CustomMessage('DownloadMsg2'), mbConfirmation, MB_YESNO) = IDNO then Result := false<br />
else if isxdl_DownloadFiles(hWnd) = 0 then Result := false;<br />
end;<br />
end;<br />
<br />
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;<br />
var<br />
s: string;<br />
<br />
begin<br />
if neededDependenciesDownloadMemo <> '' then s := s + CustomMessage('DependenciesDownloadTitle') + ':' + NewLine + neededDependenciesDownloadMemo + NewLine;<br />
if neededDependenciesInstallMemo <> '' then s := s + CustomMessage('DependenciesInstallTitle') + ':' + NewLine + neededDependenciesInstallMemo + NewLine;<br />
<br />
s := s + MemoDirInfo + NewLine + NewLine + MemoGroupInfo<br />
if MemoTasksInfo <> '' then s := s + NewLine + NewLine + MemoTasksInfo;<br />
<br />
Result := s<br />
end;<br />
in YourApp.iss, add the following after your #define statements:
<br />
#define MyAppName "YourApp"<br />
...<br />
#include "prerequisites.iss"<br />
<br />
[Setup]<br />
...<br />
Finally, make sure your variable names are in sync. For instance, if your use
[Languages]<br />
Name: english; MessagesFile: compiler:Default.isl
in YourApp.iss, you need to change
en.DependenciesDownloadTitle=Download Dependencies
to
english.DependenciesDownloadTitle=Download Dependencies
in prerequisites.iss
Lemme know if you find any bugs
Thanks
Pierre
|
|
|
|
|
Hi, many thanks, good job, you're the magician
I have a question
I am from Czech Republic a my path to Netframerok 2.0 in registry is
SOFTWARE\Microsoft\.NETFramework\v2.0.50727
not
SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727
It isn't problem for me, I've changed path but What another user on the world?
Is the another way how find out if netframework is installed?
Or I must extend If statement about next path ??
Thanks
Pet
|
|
|
|
|
Just what I was looking for
Legend.
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Hi thank good job but iwanted attach donnetframework in my CD with no download for user how i could do this , plz help me its nessery for me
if i saw your source code i could do this. thanks
|
|
|
|
|
I'm using Windows Vista and the application installs correctly. However, it prompts to install Windows Installer 3.1 and the Microsoft .NET Framework 2.0 every time I run the installation. I even tried to restart; it makes no difference.
I noticed the following in setup.iss. Is the line "IsMinMSIAvailable(23,0)" suppose to be "IsMinMSIAvailable(3,0)"?
if WindowsVersion.NTPlatform and
(WindowsVersion.Major >= 5) and
(not IsMinMSIAvailable(23,0)) then
Also, I noticed the following too for the .net check. It seems the 2 is not needed in this statement either. Should this be "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" instead of
"2SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727"?
if (not RegKeyExists(HKLM, '2SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727')) then begin
Can someone verify to make sure the files to download are correct? Thanks!
modified on Monday, December 03, 2007 8:57:18 PM
|
|
|
|
|
From my testing NET20 will install on WinXP(SP0) only if MSI 3.1 is installed first, since MSI3.1 is part of SP2 service pack.
Also, with WinME I would just install MSI3.1, this mean you could delete all of the MSI2.0 script and dependencies and re-use your MSI3.1 script.
I like things simply as possible anyway.
J.S.
|
|
|
|
|
Message Closed
modified 23-Dec-20 12:34pm.
|
|
|
|
|
Message Closed
modified 5-Aug-20 5:58am.
|
|
|
|
|
http://support.microsoft.com/kb/811113[^]
http://support.microsoft.com/?kbid=811148[^]
http://support.microsoft.com/?kbid=309495[^]
http://support.microsoft.com/?kbid=811996[^]
Heres some NSIS GetVersion code from one of my articles..
Section 'MSI 3.1' SEC02 #NOTE should be installed before NET and stuff
GetDLLVersion '$SYSDIR\msi.dll' $R0 $R1
IntOp $R2 $R0 / 0x00010000 ; $R2 now contains major version
IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version
IntOp $R4 $R1 / 0x00010000 ; $R4 now contains release
IntOp $R5 $R1 & 0x0000FFFF ; $R5 now contains build
StrCpy $0 '$R2.$R3' ;.$R4.$R5' ; $0 now contains string like '1.2.0.192'
${if} $R2 < '4'
${if} $0 != '3.1'
SetOutPath '$TEMP'
SetOverwrite on
File 'd:\folder\WindowsInstaller-KB893803-v2-x86.exe'
ExecWait '$TEMP\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart' $0
DetailPrint '..MSI 3.1 exit code = $0'
Delete '$TEMP\WindowsInstaller-KB893803-v2-x86.exe'
${Else}
DetailPrint '..MSI $0 already installed !!'
${EndIf}
${Else}
DetailPrint '..MSI $0 already installed !!'
${EndIf}
SectionEnd
WinMe and 98
|
|
|
|
|
Very nice article. It is worthy to be added to my CP blog of a must-read article
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Message Closed
modified 23-Dec-20 12:35pm.
|
|
|
|
|