• 25-01-2010, 01:55:56
    #1
    C# de oluşturduğum bir programı inno setup ile kurulum haline getiriyorum. Fakat framework olmayan pclerde program çalışmadığından önce .net'i var veya yok onu nasıl sorgulatabilirim? Bu adreste http://www.systemwidgets.com/Blog/ta...ng-NET-20.aspx açıklama yapılmış fakat betiği birleştirdiğimde hata oluşuyor. Setup klasörü yapılandırılamıyor. Acaba dosyaları yanlış mı konumlandırıyorum. Setup'a eklenmesi gereken betik aşağıda yazan ve dosyalar ilgili linkte var. Resimli veya açıklamalı şekilde hangi dosyaları hangi klasöre eklememi anlatırsanız sevinirim. Teşekkürler...

    Eklenmesi gereken kod:

    [Setup]
    AppName=.NET 2.0 Test Install
    AppVerName=Test
    AppVersion=Test Script
    AppPublisher=SystemWidgets
    MinVersion=0,5.01.2600
    DefaultDirName={pf}\SystemWidgets

    [Files]
    Source: ..\..\..\..\..\..\Dev\Tools\Download DLL\isxdl.dll; DestDir: {tmp}; Flags: deleteafterinstall

    [Code]
    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('This program 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;
  • 25-01-2010, 19:17:10
    #2
    Visual Studio nun kendi Setup Project kısmını kullanmama sebebin ne onu merak ettim, visual studio üzerinde zaten istediğin projenin setupını oluşturabiliyorsun.
    Alttaki linkte anlatımı var.
    http://www.doublekeyf.com/php/28427-...lusturmak.html
    Kolay Gelsin
  • 26-01-2010, 04:44:53
    #3
    circass visual studioda setup oluşturmayı biliyorum, saol varol başkasının işine yarar verdiğin link! ama ben inno setup ile .net sorgulamayı sordum ona cevap istiyorum çözemedim onu. hata alıyorum betiklerde! Tek programla yetinmek hoşuma gitmiyorda