-
Oct 17th, 2006, 11:03 AM
#1
Thread Starter
Member
[RESOLVED] How to deploy .net framework 2.0 using INNO setup
I have developed a windows application using VS 2005 standard edition. I would like to use Inno to create a single setup file that will install dotnetfx.exe if the user's computer doesn't have .net framework 2.0. Does anyone have any ideas? I am able to silently install dotnetfx.exe using Inno but I am unable to determine if the user has .net framework 2.0 on their computer. Thanks in advance for your help.
-
Oct 17th, 2006, 11:37 AM
#2
Re: How to deploy .net framework 2.0 using INNO setup
If the user has the .NET framework on their PC, and you run dotnetfx.exe, it will simply not install it, so you don't really have to worry...
you can test this if you have a clean testbox without the framework..
if you install your app on on a box without the framework, it will take X amount of time. run your installation again and it will be a lot quicker because the framework doesn't get reinstalled.
What params do you pass to dotnetfx? I use
Parameters: "/q:a /c:""install /l /q""";
-
Oct 17th, 2006, 11:43 AM
#3
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
I am using the same parameters that you are using, but it takes the same amount of time to install(4-10min) whether I have the framework on it or not. To simulate a clean machine I go to Add/Remove programs and remove .net framework 2.0. I install my inno setup file and it installs .net framework 2.0 and takes around 4 minutes to install. When I run the inno setup file for a second time on the same computer that has 2.0 framework it still takes the same amount of time to install(4 minutes). Any ideas? Thanks for your help!
-
Oct 17th, 2006, 12:09 PM
#4
Re: How to deploy .net framework 2.0 using INNO setup
well 4 and 10 minutes are considerably different amounts of time when it comes to installing something...
I found this article where the guy uses scripting and checks some reg keys to see if the framework is present or not. You may want to give this a go.
http://discuss.joelonsoftware.com/de...biz.5.402705.5
his code incorporates the isxdl.dll to download the framework if needed, but you can modify the code to just use the local dotnetfx you distribute with your app instead of downloading it.
Downloading the framework on demand is nice, but may result in problems with firewalls etc...
-
Oct 18th, 2006, 10:33 AM
#5
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
Thanks Kleinma,
That link was a great resource and I was able to get it to work if the user downloads from Microsoft. I am currently testing to get the inno script to download if necessary from the CD vs the Web. I will post it once I get it resolved. Thanks again for all of your help.
-
Oct 18th, 2006, 10:50 AM
#6
Re: How to deploy .net framework 2.0 using INNO setup
I found that it does install it whether or not it is installed and I ended up using a script checking for a reg key. I also use ISTool, which will download the dotnetfx.exe from microsoft if it is not present in the folder with the installer
here is my inno script
[code]
;ADMSIP Server Setup
#define Reports "C:\Release\ADMSIP\Reports"
#define SourceFileDir "C:\Release\ADMSIP\package"
#define Requirements "C:\Release\ADMSIP\Required"
#define IncludeFramework true
#define Client false
[Setup]
AppName=ADMSIP
AppVerName=ADMSIP
AppPublisher=RSCS,Inc.
DefaultDirName={pf}\RSCS\AMDSIP
defaultgroupname=RCSC
DisableProgramGroupPage=no
DirExistsWarning=no
UninstallFilesDir={app}
UninstallDisplayIcon={app}\ADMSIP.exe
Compression=lzma
SolidCompression=yes
VersionInfoVersion=0.1.0.0
OutputBaseFilename=Setup_Server
OutputDir={#SourceFileDir}\setup\Server
[_ISTool]
EnableISX=true
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: {#Requirements}\isxdl.dll; Flags: dontcopy
Source: {#SourceFileDir}\ADMSIP.exe; DestDir: {app}; Flags: ignoreversion
Source: {#SourceFileDir}\XPCommonControls.dll; DestDir: {app}; Flags: ignoreversion
Source: {#Requirements}\CRRedist2005_x86.msi; DestDir: {tmp}; Flags: deleteafterinstall
Source: {#Requirements}\sqlncli.msi; DestDir: {tmp}; Flags: deleteafterinstall
Source: {#Requirements}\fileImporter.exe; DestDir: {app}; Flags: ignoreversion
Source: {#Requirements}\U2LEXPO.DLL; DestDir: {sys}
Source: {#Requirements}\IsLicense.net.dll; DestDir: "{cf}\InteractiveStudios"; Flags: regserver sharedfile allowunsafefiles
Source: {#Requirements}\Interop.IsLicenseDotNet.dll; DestDir: {app}
Source: {#Requirements}\Config.ini; DestDir: {app}
[Icons]
Name: {group}\ADMSIP; Filename: {app}\ADMSIP.exe; WorkingDir: {app}
Name: {userdesktop}\ADMSIP; Filename: {app}\ADMSIP; WorkingDir: {app}
[Run]
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -remgroup ""ADMSIP"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -addgroup 1.2 -url ""file://{app}/*"" FullTrust -name ""ADMSIP"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
Filename: "msiexec.exe"; Parameters: "/q /i ""{tmp}\CRRedist2005_x86.msi""" ; WorkingDir: {tmp}; StatusMsg: "Installing required Crystal Reports components, This can take several minutes..."
Filename: "msiexec.exe"; Parameters: "/q /i ""{tmp}\sqlncli.msi""" ; WorkingDir: {tmp}; StatusMsg: "Installing SQL Server Native Client, This can take several minutes..."
FileName: "regsvr32"; Parameters: "/s ""{cf}\InteractiveStudios\IsLicense.net.dll"""; WorkingDir: {cf}; StatusMsg: "Registering DLL's"
[UninstallRun]
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -remgroup ""ADMSIP"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
FileName: "regsvr32"; Parameters: "/u /s ""{cf}\InteractiveStudios\IsLicense.net.dll"""; WorkingDir: {cf}; StatusMsg: "Registering DLL's"
[UninstallDelete]
Type: files; Name: {app}\Config.ini
Type: files; Name: {app}\XPCommonControls.dll
type: files; Name: {app}\FileImporter.exe
type: files; name: {app}\Interop.IsLicenseDotNet.dll
type: filesandordirs; name: {cf}\InteractiveStudios
type: filesandordirs; name: {app}\SQL
Code:
var
dotnetRedistPath: string;
downloadNeeded: boolean;
dotNetNeeded: boolean;
memoDependenciesNeeded: string;
procedure isxdl_AddFile(URL, Filename: PChar);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: PChar): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';
const
dotnetRedistURL = 'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe';
// local system for testing...
// dotnetRedistURL = 'http://192.168.1.1/dotnetfx.exe';
function InitializeSetup(): Boolean;
begin
Result := true;
dotNetNeeded := false;
// Check for required netfx installation
if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then begin
dotNetNeeded := true;
if (not IsAdminLoggedOn()) then begin
MsgBox('AMDS needs the Microsoft .NET Framework to be installed by an Administrator', mbInformation, MB_OK);
Result := false;
end else begin
memoDependenciesNeeded := memoDependenciesNeeded + ' .NET Framework v2.0' #13;
dotnetRedistPath := ExpandConstant('{src}\dotnetfx.exe');
if not FileExists(dotnetRedistPath) then begin
dotnetRedistPath := ExpandConstant('{tmp}\dotnetfx.exe');
if not FileExists(dotnetRedistPath) then begin
isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
downloadNeeded := true;
end;
end;
SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
end;
end;
end;
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
ResultCode: Integer;
begin
Result := true;
if CurPage = wpReady then begin
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
// don't try to init isxdl if it's not needed because it will error on < ie 3
if downloadNeeded then begin
isxdl_SetOption('label', 'Downloading Microsoft .NET Framework');
isxdl_SetOption('description', 'ADMS needs to install the Microsoft .NET Framework 2.0. Please wait while Setup is downloading extra files to your computer.');
if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
end;
if (Result = true) and (dotNetNeeded = true) then begin
if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
// handle success if necessary; ResultCode contains the exit code
if not (ResultCode = 0) then begin
Result := false;
end;
end else begin
// handle failure if necessary; ResultCode contains the error code
Result := false;
end;
end;
end;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
s: string;
begin
if memoDependenciesNeeded <> '' then s := s + 'Dependencies to install:' + NewLine + memoDependenciesNeeded + NewLine;
s := s + MemoDirInfo + NewLine + NewLine;
Result := s
end;
-
Oct 19th, 2006, 09:11 AM
#7
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
Bmahler thanks for posting your inno script. I compared it to my script and they are identical in the code section. I am still not able to install dotnetfx.exe directly from the cd vs downloading the file. Do you have any ideas? Thanks for your help.
-
Oct 19th, 2006, 09:26 AM
#8
Re: How to deploy .net framework 2.0 using INNO setup
you should copy the framework to a temp folder in the files section, and then run it from the temp folder...
something like
Code:
Source: dotnetfx.exe; DestDir: {tmp}; Flags: ignoreversion
-
Oct 19th, 2006, 09:37 AM
#9
Re: How to deploy .net framework 2.0 using INNO setup
The way that Mine runs is that I do not package the dotnetfx into the installer, because the dependency check runs before any of the file copying happens. Instead, on the cd i would have 2 files (you may have more), Installer.exe and dotnetfx.exe. When the installer runs, it checks it's source folder for dotnetfx.exe and if it is not found, it downloads it to the temp folder and installs from there. This is useful in case the user copies the installer and not the dontnetfx.exe.
If you bundle the dotnetfx.exe into the installer and tell it to copy it to the temp folder, it will donload it every time because this script checks for it before it performs any other operations, ie file copying etc...
-
Oct 19th, 2006, 10:13 AM
#10
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
Kleinma,
Once dotnetfx.exe is copied to the temp folder how do I run it in my inno script if the user doesn't have .net 2.0?
Mahler,
If I don't include dotnetfx.exe in my inno setup then where in your inno code does it check for the dotnetfx.exe file before downloading it from Microsoft?
Thanks to both of you for helping me out. This is my first app I have deployed using .net. Previously I used VB6.
-
Oct 19th, 2006, 11:18 AM
#11
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
Please disregard the previous post. After furthur stepping through the code I realized I was placing the dotnetfx.exe file in the wrong folder when I was compiling my inno setup script.
One more question for you Inno guru's what exactly does the below code (CasPol.exe do)? I assume it is setting the trust level to FullTrust but why is this necessary? Would this occur for a user that has a limited account?
[Run]
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -remgroup ""MECAWind"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -addgroup 1.2 -url ""file://{app}/*"" FullTrust -name ""MECAWind"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
[UninstallRun]
Filename: {win}\Microsoft.NET\Framework\v2.0.50727\CasPol.exe; Parameters: "-q -machine -remgroup ""MECAWind"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Setting Program Access Permissions"
Thanks again for the great code samples.
-
Oct 19th, 2006, 12:30 PM
#12
Re: How to deploy .net framework 2.0 using INNO setup
caspol is being used incase the user installs their software to a network drive.
By default the .NET framework only gives partial trust to network paths (even if they are mapped to a letter)
so if a customer were to install it to their network drive, it would likely crash in places it wouldn't if it was installed on a local drive.
Or technically (but not likely) they could have set their local drives to not have full trust for the .NET framework, in which case caspol will give the needed trust level to the applications directory.
-
Oct 19th, 2006, 01:00 PM
#13
Thread Starter
Member
Re: How to deploy .net framework 2.0 using INNO setup
Thanks Kleinma and Mahler for all of your help. I learned a lot about deploying .net 2.0.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|