IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Programme requis avant installation


Sujet :

C#

  1. #1
    Membre régulier Avatar de kazylax
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    278
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 278
    Points : 121
    Points
    121
    Par défaut Programme requis avant installation
    Bonsoir,

    Mon programme requis avant sont installation (Framework 4)
    je voudrais que l'utilisateur si il lance mon programme alors qui n'a pas Framework il lance un avertissement.

    mais je c'est pas comment faire du tout
    car si la personne n'a pas le framework le programme plante sans dire se qui ne va pas

    Savez vous comment je peux faire ceci s'il vous plait ?

    avec (Microsoft Visual C# 2010 Express)

    Merci
    Cordialement,

  2. #2
    Membre extrêmement actif Avatar de fally
    Homme Profil pro
    Développeur .Net / BI
    Inscrit en
    Novembre 2007
    Messages
    966
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Bénin

    Informations professionnelles :
    Activité : Développeur .Net / BI

    Informations forums :
    Inscription : Novembre 2007
    Messages : 966
    Points : 1 173
    Points
    1 173
    Par défaut
    salut,
    comment as-tu créé ton application? Avec un projet d'installation tu peux définir le framework comme "requis" et l'installer le cas échéant.

  3. #3
    Membre régulier Avatar de kazylax
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    278
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 278
    Points : 121
    Points
    121
    Par défaut
    Bonjour,

    Je me sert de
    Inno Setup Compiler

    mais je ne vois pas du tout comment faire avec celui-ci

    cordialement,

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    391
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 391
    Points : 347
    Points
    347
    Par défaut
    Bonjour

    Dans innosetup, tu peux lire une clef registre dans la partie code.
    il suffit de touver la bonne dans le registre pour le .net 4.0 et ne pas installer ou faire le code permettant de telecharger le framework.

    Il y a plein d'exemple sur le web avec le 2.0 ou le 3.5.
    En changeant la clef à chercher et le lien de download cela doit de faire.

    le code suivant est pour le 2.0
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
     
    [Setup]
    AppName=.NET 2.0 Test Install
    AppVerName=Test
    AppVersion=Test Script
    AppPublisher=SystemWidgets
    MinVersion=0,5.01.2600
    DefaultDirName={pf}\SystemWidgets
     
    [Files]
    Source: C:\Program Files\ISTool\isxdl.dll; DestDir: {tmp}; Flags: deleteafterinstall
     
     
    var
    	dotnetRedistPath: string;
    	downloadNeeded: boolean;
    	dotNetNeeded: boolean;
    	memoDependenciesNeeded: string;
    	Version: TWindowsVersion;
     
    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';
     
    //*********************************************************************************
    // This is where all starts.
    //*********************************************************************************
    function InitializeSetup(): Boolean;
     
    begin
     
    	Result := true;
    	dotNetNeeded := false;
    	GetWindowsVersionEx(Version);
     
    	//*********************************************************************************
    	// Check for the existance of .NET 2.0
    	//*********************************************************************************
        if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then
    		begin
    			dotNetNeeded := true;
     
    			if (not IsAdminLoggedOn()) then
    				begin
    					MsgBox('PainlessSVN Professional Beta 1 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;
      ResultXP: boolean;
      Result2003: boolean;
     
    begin
     
      Result := true;
      ResultXP := true;
      Result2003 := true;
     
      //*********************************************************************************
      // Only run this at the "Ready To Install" wizard page.
      //*********************************************************************************
      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
     
    		//*********************************************************************************
    		// Download the .NET 2.0 redistribution file.
    		//*********************************************************************************
    		if downloadNeeded and (dotNetNeeded = true) then
    			begin
    				isxdl_SetOption('label', 'Downloading Microsoft .NET Framework 2.0');
    				isxdl_SetOption('description', 'This program 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;
     
    		//*********************************************************************************
    		// Run the install file for .NET Framework 2.0. This is usually dotnetfx.exe
    		//*********************************************************************************
            	if (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;
     
    //*********************************************************************************
    // Updates the memo box shown right before the install actuall starts.
    //*********************************************************************************
    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;
    cordialement

  5. #5
    Membre régulier Avatar de kazylax
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    278
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 278
    Points : 121
    Points
    121
    Par défaut
    Merci pour votre aide
    je vais voir se que je peux faire

    Cordialement,

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Inno Setup] Installation programme avant installation
    Par the java lover dans le forum Outils
    Réponses: 17
    Dernier message: 25/09/2008, 21h00
  2. Réponses: 2
    Dernier message: 28/03/2007, 20h28
  3. Partitionnement dd avant installation multiboot
    Par lou0123 dans le forum Windows XP
    Réponses: 2
    Dernier message: 10/01/2007, 21h21
  4. Dernière question avant installation
    Par Iceman6259 dans le forum Mandriva / Mageia
    Réponses: 8
    Dernier message: 25/05/2005, 18h57

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo