InnoSetup .NET Framework 2 (x86 ve x64) ekleme kodunu yapamadım sanırım PERL

Bu konuyu okuyanlar

Vatansever

Asistan
Katılım
23 Ağu 2007
Mesajlar
405
Reaksiyon puanı
1
Puanları
18
Inoo setup + Istool kullanarak bir kurulum hazırlıyorum, kurulumunu hazırladığım program .NET Framework 2'ye ihtiyaç duyuyor bunun x86 ve x64 versiyonlarını kuruluma eklemek eğer bilgisayarda yoksa önce bunu offline olarak yüklesin sonra program yüklensin istiyorum ama başaramıyorum aşağıdaki adreste bu iş için bir proje var ama ben kodları doğru yerlere yerleştiremedim herhalde hep kod hataları alıyorum olmuyor nerede ne yapmam gerektiğini çok iyi anlamadım yardım edebilirmisiniz?


http://www.codeproject.com/Tips/506096/InnoSetup-with-NET-installer-x-x-sample


InnoSetup with .NET installer x86/x64 sample
First of all, it's always a good practice to define the working folder where we put the files used by the installer;
Something like this:


Kod:
#define MyDistFolder "E:\dist\MyApp"

In the
Kod:
[/B] section, we now define the functions that check for the .NET version installed.
     This code is directly taken from Jordan Russell's site.

 [CODE]
function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1.4322'     .NET Framework 1.1
//    'v2.0.50727'    .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key: string;
    install, release, serviceCount: cardinal;
    check45, success: boolean;
var reqNetVer : string;
begin
    // .NET 4.5 installs as update to .NET 4.0 Full
    if version = 'v4.5' then begin
        version := 'v4\Full';
        check45 := true;
    end else
        check45 := false;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0/4.5 uses value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 uses additional value Release
    if check45 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= 378389);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;

This is a global function that verifies if the .NET Framework version passed as an argument is properly installed.
Now we should write a simple function that is called by the installer in runtime, to verify if the required .NET version is installed. We'll use 4.0 as an example.


Kod:
function IsRequiredDotNetDetected(): Boolean;  
begin
    result := IsDotNetDetected('v4\Full', 0);
end;


If we want, we can also release a message during the setup process:

Kod:
function InitializeSetup(): Boolean;
begin
    if not IsDotNetDetected('v4\Full', 0) then begin
        MsgBox('{#MyAppName} requires Microsoft .NET Framework 4.0 Client Profile.'#13#13
          'The installer will attempt to install it', mbInformation, MB_OK);        
    end
    
    result := true;
end;
The code section is complete, now we can focus on the [Files] section.
Kod:
Source: "{#MyDistFolder}\dotNetFx40_Full_setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: not IsRequiredDotNetDetected

The setup will copy the .NET installer file (which is a smart file of about 850 KB), only if is not already present in the system, to the system temp directory. Once the install finishes, the file will be deleted.
Now that the net web installer is copied, we need to run it if required.
In the [Run] section, write this:
Kod:
Filename: {tmp}\dotNetFx40_Full_setup.exe; Parameters: "/q:a /c:""install /l 
  /q"""; Check: not IsRequiredDotNetDetected; StatusMsg: Microsoft Framework 4.0 is beïng installed. Please wait...


And that's all.
x86/x64 options

This sample shows how the installer behaves according to the system architecture.
It will install the native libraries required by the system in order to make a more smart installation.
In the [Setup] section, define this directive:
Kod:
ArchitecturesInstallIn64BitMode=x64

These two rows will install a lib folder according to the system:
Kod:
Source: "{#MyDistFolder}\lib\x64\*"; DestDir: "{app}\lib\x64"; Check: Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#MyDistFolder}\lib\x86\*"; DestDir: "{app}\lib\x86"; Check: not Is64BitInstallMode; Flags: ignoreversion recursesubdirs createallsubdirs
 

kmurat

Dekan
Katılım
8 Şub 2014
Mesajlar
7,346
Reaksiyon puanı
2,953
Puanları
113
İnno setup bir Dephi bileşeniymiş (Pascal script'i) İnno setup dışında, Microsoft'un Netframework için sunduğu kurulum yöneticisinide (bu durumda Net.2 için olan Net installer) birlikte (önceden edinipte) kullanmak gerekiyormuş.

İlk olarak, Net'in kurulu olduğunu denetleyebilmek için, uygulamanın çalıştırılacağı klasör yolunu belirtmek gerekiyormuş.

Netframework'ün aranan sürümü kurulu değilse, Net installer sistemin Temp klasörüne kopyalanıyormuş. Net Kurulumu gerçekleştikten sonra da siliniyormuş.
 
Üst