.exe file sharing

Make sure you build your app in ‘Release’ mode, otherwise you’ll end up having dependencies on debug libraries, for which there are no redistributables. If you absolutely must build it in debug mode, then you will need to manually include debug libraries with your app (meaning copy them into the folder where your app EXE resides before packaging them up with an installer).

After you build in release mode, it’s best you use an installer, as slackmoehrle mentioned. A relatively easy and free one to use is Inno Setup.

Here’s an installer script that will work in Inno Setup. Just replace the relevant parts:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Game"
#define MyAppVersion "0.1"
#define MyAppPublisher "PublisherName"
#define MyAppURL "www.yourdomain.com"
#define MyAppExeName "MyGame.exe"
#define MyAppDataFolder "MyGame"

[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={A957B1B5-1F55-4497-B1F0-812EDB3C066B} ; ** IMPORTANT, GENERATE YOUR OWN GUID **
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=MyGameSetup
; Password=AnInstallPasswordIfRequired; Uncomment this if you want an install password
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

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

[Files]
Source: "C:\SamplePath\win32_build_folder\MyGame\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

[UninstallDelete]
Type: filesandordirs; Name: "{localappdata}\{#MyAppDataFolder}"
1 Like