Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile to single executable file
#1
Gintaras, the work you've done on C# Uiscripter is excellent. It makes learning C# fun and accessible and the level of engineering you've put into the language and editor features is remarkable. I come from a PowerShell background and am attracted to C# Uiscripter because I need to create a single exe file, plus C# syntax is much more appealing to me than the baroque syntax of PowerShell. When do you plan on adding the ability to create a true standalone executable without the additional dlls? Also, thanks for all the great examples in the cookbook/recipes, I'm learning a lot.
#2
The only way is to pack all files into a single executable file that extracts them to a temporary folder and executes the actual exe program. Or let the exe program itself contain/extract files if possible.

The main problem here is criminals. They will use this to create single-file malware. As a result, antivirus programs will kill ALL programs created by anybody in this way. It happened with Appacker, PyInstaller... Therefore I don't want to add this feature.

It seems antivirus programs are less aggressive if to pack files is used a popular installer, for example Inno Setup. Example Inno Setup script:

Code:
Copy      Help
; Edit the #define values. Don't need to edit other code.

; The setup program name without ".exe"
#define MyAppName "Packed"
; The exe program name (script name) with ".exe"
#define MyAppExeName "Exe1.exe"
; The script's outputPath property, like /*/ role exeProgram; outputPath C:\Test\Exe1; /*/
#define MyAppSourceDir "C:\Test\Exe1"
; These are not important
#define MyAppVersion "1.0"
#define MyAppPublisher "Me"


[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
AppId={#MyAppName}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={%tmp}\{#MyAppName}
DisableDirPage=yes
DisableProgramGroupPage=yes
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
OutputDir=C:\Test
OutputBaseFilename={#MyAppName}
Compression=lzma
SolidCompression=yes
;DisableReadyPage=yes  ;does not work when there are no other pages
UsePreviousAppDir=no
Uninstallable=no

[Files]
Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "Run"; Flags: nowait postinstall

[Code]
function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
  lpParameters: string; lpDirectory: string; nShowCmd: Integer): Integer;
  external 'ShellExecuteW@shell32.dll stdcall';

function InitializeSetup: Boolean;
begin
  // if this instance of the setup is not silent which is by running
  // setup binary without /SILENT parameter, stop the initialization
  Result := WizardSilent;
  // if this instance is not silent, then...
  if not Result then
  begin
    // re-run the setup with /SILENT parameter; because executing of
    // the setup loader is not possible with ShellExec function, we
    // need to use a WinAPI workaround
    if ShellExecute(0, '', ExpandConstant('{srcexe}'), '/VERYSILENT', '',
      SW_SHOW) <= 32
    then
      // if re-running this setup to silent mode failed, let's allow
      // this non-silent setup to be run
      Result := True;
  end;
end;


Forum Jump:


Users browsing this thread: 1 Guest(s)