-
INNO Scripting doubt
I am a new user of INNO Setup creation application.
I tried to add fw 2.0 to my setup and here is the code
Code:
[Run]
;INSTALL THE FRAMEWORK IF IT WAS INCLUDED
;THIS LINE RUNS THE FRAMEWORK INSTALL
Filename: {tmp}\dotnetfx.exe; Parameters: "/q:a /c:""install /l /q"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Checking for and installing .NET Framework if needed, This can take several minutes..."
;THESE LINES ARE TO GIVE THE PATH TO YOUR EXE FULL TRUST ON THE MACHINE
;THIS IS DONE BECAUSE IF THE USER INSTALLS THE SOFTWARE TO A NETWORK SHARE
;IT WILL HAVE LIMITED TRUST BY DEFAULT. INSTEAD OF MAKING THE USER HAVE TO MANAGE THIS MANUALLY
;IN THE .NET FRAMEWORK MANAGEMENT, WE GIVE THE APP DIR FULL TRUST USING CASPOL
;THE FIRST LINE DELETES ANY EXISTING REFERENCE TO THIS APP (INCASE THIS IS A REINSTALL)
;THE SECOND LINE GIVE THE FULL TRUST BACK
;IF YOU DONT INCLUDE THE FIRST LINE, AND USER IS REINSTALLING, THEN YOU WILL END UP WITH 2 ENTRIES
Filename: {win}\Microsoft.NET\Framework\v2.0.50727.42\CasPol.exe; Parameters: "-q -machine -remgroup ""ImagePro"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions..."
Filename: {win}\Microsoft.NET\Framework\v2.0.50727.42\CasPol.exe; Parameters: "-q -machine -addgroup 1.2 -url ""file://{app}/*"" FullTrust -name ""ImagePro"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions..."
[UninstallRun]
;ON UNINSTALL, REMOVE CASPOL ENTRY FOR FULL TRUST
Filename: {win}\Microsoft.NET\Framework\v2.0.50727.42\CasPol.exe; Parameters: "-q -machine -remgroup ""TestMtx""";
My problem is that the framework gets reinstalled everytime I run the setup. that is, evenif the computer has fw 2.0 installed in it, the setup reinstalls the fw.
Also this code is to run the fw setup in background (hidden). How can I unhide the fw installation so that user can interact with it?
-
Re: INNO Scripting doubt
Why not just use the Setup Project of VS? It handles the framework and can create shortcuts.
-
Re: INNO Scripting doubt
The problem is that you force the fw installer to run everytime.
Consider this:
In the Run Section of the script:
Code:
FileName: {tmp}\dotnetfx.exe; Check: InstallNetFramework(ExpandConstant('{tmp}\dotnetfx.exe'))
In the code section of the script:
Code:
function DotNet2Installed(): boolean;
//This routine will return false if the framework is already installed
var
success: boolean;
install: cardinal;
begin
//test for v1.1 of the frame work
//success := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'Install', install);
//test for v2 of the frame work
success := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'Install', install);
Result := success and (install = 1);
end;
function InstallNetFramework(installer: String): Boolean;
//this routine will check to see if the installer exists and the correct version of .Net exists.
//if the installer doesn't exist, the routine returns false as there is nothing to install
//if the correct version of the .Net framework exists, then the routine returns false as well
//indicating that it is not necessary to install the framework
var
netInstallerExists: boolean;
netFrameworkInstalled: boolean;
begin
netInstallerExists := FileExists(installer);
netFrameworkInstalled := DotNet2Installed;
Result := netInstallerExists and not netFrameworkInstalled
end;