For those interested in using InnoSetup to build Windows executables, I found the following ant task to work well with the .iss script I have. In my process I run “Build Installers” first, then call this task manually. I purposely unzip the output so that I can include just the 64 bit .exe file. I sign the installer, uninstaller and the target .exe file. Seems to work well on Windows 10 such as add/remove programs, file associations, icons, elevating permissions in Active Directory environments, etc. Perhaps this will help someone else.
<target name="create-windows-setup" depends=" suite.build-launchers"> <!-- build installers first --> <echo message="Replacing configuration file of Windows launcher executable."/> <copy file="${basedir}/app.conf" tofile="${basedir}/build/launcher/etc/${app.name}.conf" failonerror="true" overwrite="true"/> <echo message="Creating App Setup.exe" /> <unzip src="${basedir}/dist/app.zip" dest="${basedir}/dist/app"/> <exec executable="C:\Program Files (x86)\Inno Setup 5\ISCC.exe"> <arg value="D:\Steve\Documents\NetBeansProjects\App\innosetup.iss" /> <!-- Pass in version number as exe file doesn't have a fileversion in it for the script to extract with one of their functions --> <arg value="/DproductVersion= ${app.version}" /> <!-- need to define the signtool exactly like in script file as it is not available to command line tool. Diferent registry entries --> <arg value="/Scodesigner=$qC:\apps\signing\signtool.exe$q sign $p" /> </exec> </target> A little long, but here is my complete Innosetup script: ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [ISPP] #define AppURL "http://www.app.ca/" #define appname "My App" #define appnamelowercase "app" #define appcopyrightprefix "Copyright (C) 2018" #define apppublisher "My Company" #define appprojectfile appname + " Project File" #define appsourcedir "D:\Steve\Documents\NetBeansProjects\app\dist\app\app" #define licensefile "D:\Steve\Documents\NetBeansProjects\app\ConfigurationModule\src\com\company\branding\license.txt" #define iconfile "D:\Steve\Documents\NetBeansProjects\app\ProjectEditormodule\src\com\company\icons\MyIcon.ico" #define SrcApp appnamelowercase + "64.exe" #define AppExeSourcePath appsourcedir + "\bin\" + SrcApp ;default for local compiling. Otherwise productVersion is passed in with /D switch on command line or ant script #define appversion "6.72.67" #ifdef productVersion #define appversion productVersion #endif #pragma warning "Variable appversion value is: " + appversion ; SignTool parameters #define SignedDesc "$q" + "$appname" + "$q" #define SignedPfx "C:\apps\signing\MyPrivateKey.pfx" #define SignedTimeStamp "http://timestamp.comodoca.com?td=sha256" #define SignedPw "password" [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={{your ID, generated automatically} AppName={#appname} AppVersion={#apppublisher} AppVerName={#appname} {#appversion} AppCopyright={#appcopyrightprefix} {#apppublisher} AppPublisher={#apppublisher} AppPublisherURL={#AppURL} AppSupportURL={#AppURL} AppUpdatesURL={#AppURL} AppReadmeFile={#AppURL} UninstallDisplayName={#appname} {#appversion} UninstallDisplayIcon={#iconfile} VersionInfoVersion={#appversion} DefaultDirName={pf}\{#appname} DisableProgramGroupPage=yes LicenseFile= {#licensefile} OutputBaseFilename={#appname} Setup SetupIconFile={#iconfile} Compression=lzma SolidCompression=yes ; "ArchitecturesAllowed=x64" specifies that Setup cannot run on ; anything but x64. ArchitecturesAllowed=x64 ; "ArchitecturesInstallIn64BitMode=x64" requests that the install be ; done in "64-bit mode" on x64, meaning it should use the native ; 64-bit Program Files directory and the 64-bit view of the registry. ArchitecturesInstallIn64BitMode=x64 PrivilegesRequired=admin AllowNetworkDrive=no AllowUNCPath=no AppContact=supp...@company.com ChangesAssociations=yes ChangesEnvironment=yes CloseApplications=yes SignTool=codesigner /f {#SignedPfx} /p {#SignedPw} /tr {#SignedTimeStamp} /td sha256 /fd sha256 /v $f SignedUninstaller=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" Name: "french"; MessagesFile: "compiler:Languages\French.isl" [Messages] FinishedLabel=Setup has finished installing [name] on your computer. If this is a re-installation of [name], it is strongly advised that you manually delete the /AppData/Roaming/.app directory for the User(s) on this computer; prior to launching [name]. [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "{#appsourcedir}\bin\{#SrcApp}"; DestDir: "{app}\bin"; Flags: ignoreversion sign Source: "{#appsourcedir}\etc\*"; DestDir: "{app}\etc"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#appsourcedir}\ide\*"; DestDir: "{app}\ide"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#appsourcedir}\nb\*"; DestDir: "{app}\nb"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#appsourcedir}\platform\*"; DestDir: "{app}\platform"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#appsourcedir}\{#appnamelowercase}\*"; DestDir: "{app}\{#appnamelowercase}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "C:\Program Files\Java\jre1.8.0_181\*"; DestDir: "{app}\jre\"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] Name: "{commonprograms}\{#appname}"; Filename: "{app}\bin\{#SrcApp}" Name: "{commondesktop}\{#appname}"; Filename: "{app}\bin\{#SrcApp}"; Tasks: desktopicon [Registry] Root: HKCR; SubKey: ".{#appnamelowercase}"; ValueType: string; ValueData: "{#appprojectfile}"; Flags: uninsdeletekey Root: HKCR; SubKey: "{#appprojectfile}"; ValueType: string; ValueData: "{#appprojectfile}"; Flags: uninsdeletekey Root: HKCR; SubKey: "{#appprojectfile}\Shell\Open\Command"; ValueType: string; ValueData: """{app}\bin\{#SrcApp}"" ""%1"""; Flags: uninsdeletekey Root: HKCR; Subkey: "{#appprojectfile}\DefaultIcon"; ValueType: string; ValueData: "{app}\bin\{#SrcApp},0"; Flags: uninsdeletevalue Regards, Stephen Cumminger From: Neil C Smith <neilcsm...@apache.org> Sent: Saturday, July 28, 2018 9:27 AM To: stephen cumminger <stephen.cummin...@sonideft.com>; users@netbeans.apache.org Subject: Re: Installer bug? On Sat, 28 Jul 2018, 12:27 stephen cumminger, <stephen.cummin...@sonideft.com<mailto:stephen.cummin...@sonideft.com>> wrote: Thanks for the idea Neil. I used InnoSetup years ago and it always worked well for me. I use Ant to build everything. I assume you would just build a zip distribution and then manually run InnoSetup? I did create a self extracting JRE bundle, but I can probably just use the zip'd version of that now in the setup. Any pointers would be helpful. Thanks. Currently I'm doing it manually from the zip distribution after adding a jdk subfolder with OpenJDK in it, and updating the conf jdkhome to point there (no additional setup / extraction required). But I'm planning to add it all into ant at some point soon now it's working. InnoSetup has a CLI interface that can be called from ant - eg. https://stackoverflow.com/questions/21314199/ant-exec-task-with-wineprefix Obviously wine is required on Linux and macOS, but it can be called directly on Windows. Have even seen a recipe for doing it on Travis. Best wishes, Neil