An installer for your application with an embedded .NET distribution?

  • 0
    Please advise a good installer builder that allows you to patch the .NET distribution of the required version, and it starts automatically, and not just displays a window or offers to download (as Smart Install Maker does, for example).
    C# Sean Meyer, May 3, 2019

  • 2 Answers
  • 0
    Wix
    Anonymous

  • 0
    Inno Setup. Example script:
    ; Script generated by the Inno Script Studio Wizard.
    ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

    #define MyAppName "Моя программа"
    #define MyAppVersion "1.6.2.0"
    #define MyAppPublisher "ООО Бирюльки"
    #define MyAppURL "http://www.example.com/"
    #define MyAppExeName "NameOfMainExeFile.exe"
    #define SetupName "setup_my_programm"

    [Setup]
    ; NOTE: The value of AppId uniquely identifies this application.
    ; Do not use the same AppId value in installers for other applications.
    ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
    AppId={{390B67EF-46E4-45B6-B6F9-C9C6362FE337}
    AppName={#MyAppName}
    AppVersion={#MyAppVersion}
    ;AppVerName={#MyAppName} {#MyAppVersion}
    AppPublisher={#MyAppPublisher}
    AppPublisherURL={#MyAppURL}
    AppSupportURL={#MyAppURL}
    AppUpdatesURL={#MyAppURL}
    DefaultDirName="{pf}\MyProgramm"
    DefaultGroupName={#MyAppName}
    OutputBaseFilename={#SetupName}{#MyAppVersion}
    Compression=lzma
    SolidCompression=yes

    [Languages]
    Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

    ; NOTE: Don't use "Flags: ignoreversion" on any shared system files

    [Files]
    Source: "{#SourcePath}NDP461-KB3102436-x86-x64-AllOS-ENU.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall; Check: not DotNetFrameworkIsInstalled
    Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.exe"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.exe.config"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\GalaSoft.MvvmLight.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\System.Web.Razor.xml"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}DopCalc\bin\Release\Templates\*"; DestDir: "{app}\Templates"; Flags: ignoreversion createallsubdirs recursesubdirs

    [Icons]
    Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
    Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

    [Run]
    Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
    Filename: "{tmp}\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"; Parameters: "/passive /showfinalerror /norestart /x86 /x64"; Check: not DotNetFrameworkIsInstalled; StatusMsg: Microsoft Framework 4.6.1 устанавливается. Пожалуйста подождите...

    [Code]
    function DotNetFrameworkIsInstalled(): Boolean;
    var
    bSuccess: Boolean;
    regVersion: Cardinal;
    begin
    Result := False;
    bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion);
    if (True = bSuccess) and (regVersion >= 394254) then begin
    Result := True;
    end;
    end;



    In the function of checking whether .NET is installed, you will need to replace 394254 with the code of your .NET version: MSDN
    Jace Castaneda

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!