(Not logged on) | Register | Log On

You can subscribe to this discussion group using an RSS feed reader. The Business of Software

A community discussing the business of software, from the smallest shareware operation to Microsoft. A part of Joel on Software.

This community works best when people use their real names. Please register for a free account.

Links:

» Joel on Software discussion
» Business of Software discussion
» Business of Software FAQ
» Business of Software Wiki
» Forum guidelines (Please read before posting!)

Movie:

"Make Better Software" is a 6 movie course designed to help you as you grow from a micro-ISV to a large software company.
Part 1: Recruiting
Part 2: Team Members
Part 3: Environment
Part 4: Schedules
Part 5: Lifecycle
Part 6: Design

Moderators:

Eric Sink
SourceGear

Bob Walsh
Founder, StartupToDo.com Author of The Web Startup Success Guide and Micro-ISV: From Vision To Reality

Patrick McKenzie
Bingo Card Creator

Andy Brice
Successful Software

INNO SETUP Script to download and install .NET Framework 2.0

Hi Guys,

Earlier I was ask why I post lots of questions with no real contribution to the forum.

Here is Stucko's contribution to the mISV community.. However small it may be it still should be usefull to a few of you.

I found this forum just about a month ago.

I used random Nicknames when posting.  Stucko stuck with me when I got stuck on a specific issue :)  get it?  Stucko :) anyways.  I help this helps.  If you need specific help with this.. please let me know.. If you have any improvement suggestions Please add to this post.

This only downloads and install the English version.  other language support may be added.


Below is an INNO Setup scrip code section to detect if .net framework exists for  .net 2.0.  a modification of the 1.1 detection script that exists.  It will download and install it if it does not exist on users computer.

========================
you need to install the isxdl.dll and use ISTool addon for the INNO Setup.
========================

Add this section to inno setup script as the CODE section.. isxdl.dll required for this to work..

[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 GetUserDefaultLangID() = 'English') then begin

        //msgbox('Language Is Not English');

  //end;

  if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then begin
    dotNetNeeded := true;
    if (not IsAdminLoggedOn()) then begin
      MsgBox('Image Gallery Designer 0.9 needs the Microsoft .NET Framework 2.0 to be installed by an Administrator', mbInformation, MB_OK);
      Result := false;
    end else begin
      memoDependenciesNeeded := memoDependenciesNeeded + '      .NET Framework 2.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 2.0');
      isxdl_SetOption('description', 'Image Gallery Designer 0.9 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 that will be automatically downloaded And installed:' + NewLine + memoDependenciesNeeded + NewLine;
  s := s + MemoDirInfo + NewLine + NewLine;

  Result := s
end;


======================
======================
Stucko
Saturday, October 14, 2006
 
 
I'm very sorry.. I think i may have posted this in the wrong section.. Should be under Design of Software? maybe?
Stucko
Saturday, October 14, 2006
 
 
Go stucko go! You rock!
HE-MAN and the Masters of the universe
Sunday, October 15, 2006
 
 
Thanks stuco! This is _very_ useful, no matter where it's posted.
Matthias Winkelmann Send private email
Sunday, October 15, 2006
 
 
Tritto! That's very cool! Thanks for posting that. I may just ditch the VS installer and bootstrapping now. (Need to check it out in detail first of course - but still very cool of you to post it.)
Ryan Smyth Send private email
Sunday, October 15, 2006
 
 
Thanx guys,

Post a question here if need to help with implementing it in your project.


this is a modified version of the 1.1 .net download and installer available out ther..
Cant seem to findthe url so if someone knows where this original 1.1 .net  version is please post url. it has the details tutorial on how to make it work.

just change the code section with the one posted above.
Stucko
Sunday, October 15, 2006
 
 
I wrote up the setup I used to install .NET 1.1 for TimeSprite a while back. You can find it at:
http://www.timesprite.com/BlogEntries/InnosetupDotnet.html

Since then I have had a couple of people installing TimeSprite tell me they already had the framework installed and it wasn't detected, but I haven't figured out why the .NET registry entries were missing, or any better entries to test.
Andrew Rowley Send private email
Sunday, October 15, 2006
 
 
Hi,

Looks like mine is the modified version of yours that detects 2.0 framework and installs if needed.

havent tested in other languages..dont know if it causes problems..  but works fine for me so far.

Sunday, October 15, 2006
 
 
Stucko, when are you posting your program for beta testing?
HE-MAN and the Masters of the universe
Monday, October 16, 2006
 
 
Here's a page that gives good info re: invoking the installer and what registry keys to check for:

  blogs.msdn.com/astebner/archive/2006/01/15/513125.aspx
jbf
Tuesday, October 17, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz