UserGuide

Desktop App Deployment

From Xojo Documentation

This topic covers the various ways you can deploy desktop apps on Windows, Mac and Linux.

Windows

On Microsoft Windows, apps are deployed using installers. Any installer tool will work on your apps, including: Inno Setup, Advanced Installer, NSIS, InstallForge, CreateInstall and InstallShield.

  • Sample Inno Setup Script for 32-bit apps
  • Sample Inno Setup Script for 64-bit apps

Note: These installer tools all have to be run on Microsoft Windows in order to create a Windows installer. However, Inno Setup does work with WINE to allow it to be run on macOS or Linux. Regardless, you should always test your installers on actual Windows systems.

Installers

When you create your installer, you need to tell it to include all the files necessary to run the app. At a minimum, this includes the EXE file and the contents of its associated Libs and Resources folders.

For example, an app called Sliders would create a file called "Sliders.exe" and a folders called "Sliders Libs" and "Sliders Resources". The Libs folder contains DLLs for libraries, plugins and other associated files needed by your app.

If your app has other support files or folders, such as a Resources folder, then make sure that your installer includes them as well.

Setup.exe or MSI

Most installer tools allow you to create your installer as a Setup.exe file or as an MSI (Microsoft Installer) file. Either work fine, but MSI files have the advantage of being the current recommended method from Microsoft and can be used by IT departments for better control of installations. Choose what works best for your customers.

Location and Shortcuts

Windows apps are installed to the Program Files folder. On 64-bit systems, 32-bit apps are installed to the Program Files (x86) folder.

Windows users expect to have easy access to your application, so this means you should create easily accessible shortcuts. Your installer tool should provide you with the option of creating a shortcut for the user on the Desktop and in the Start Menu.

Zip

For very simple distribution, you can Zip the application and its supporting files (such as the Libs folder). You can create a Zip by right-clicking on the parent folder in Windows Explorer and selecting Send To -> Compressed (zipped) Folder.

Once unzipped, the application can be run from any location.

Although this can be useful for testing purposes, it is not recommended for proper Windows application deployment.

Microsoft Redistributable Files

Your applications require the Windows Universal Runtime. Your installer should include the necessary redistributable in order for you app to work properly.

Mac

Generally, Mac apps consist of a single App file, called the Application Bundle. You can embed other files into the Application Bundle because it is technically a folder that macOS treats as a file. In Finder, you can right-click on any App and select “Show Package Contents” to see the actual contents of the Application Bundle as a folder.

Of course, your app can still have separate files not in the Bundle, in which case you want to make sure that your app is in a folder of its own.

Since apps are technically a folder, you have to include them in some sort of container in order to distribute them, such as disk images (DMG), installers and even simple Zip files.

Disk Images (DMG)

A disk image is a file that simulates a disk or drive. After downloading the file (and double-clicking it), it appears in the sidebar of the Finder as a drive. This is called “mounting” the disk image. When the user clicks on the drive in the Finder sidebar, they see your app and typically drag it to the Applications folder to install it.

To create a disk image, you can use the Disk Utility app included with macOS or try one of the many specialized disk image creation tools such as DMG Canvas.

A disk image is probably the most common way to install Mac apps, but keep in mind that some users (especially those new to Mac) may find the concept of mounting a drive and dragging a file to the Applications folder very confusing.

Also consider that if the user mistakenly tries to run the app directly from the disk image, it may not behave as expected because the disk image is read-only.

Installers

You can also use an actual installer to install a Mac app, but it is not common for apps distributed outside the Mac App Store. To create an installer you can use the PackageMaker tool (included with the Mac Development tools) or you can use the free Packages installer.

An installer gives you more control over permissions and other settings, but they can be much more difficult to create than a simple disk image. Also, remember that an installer on Mac (a pkg file) is actually a bundle so you also have to distribute it in a disk image or a Zip.

Zip

A Zip file is an archive of your app. A zip is easy to download and most users understand what they are. They can usually be unzipped by simply double-clicking on them, which reveals the app itself. The app can then be manually copied to the Applications folder.

You can create a Zip by right-clicking on your app in the Finder and selecting Compress.

Code Signing for GateKeeper

Refer to Mac Code Signing for information on how to code-sign your apps so that users do not get GateKeeper warnings when they try to run or install them.

Mac App Store

The Mac App Store is a great way to distribute your Mac apps. People find it easy and convenient to purchase applications from the Mac App Store. Alas, getting apps into the Mac App Store is not easy or convenient for the developer. There are several restrictions and extra tasks you have to do to your app so that it will get approved for the Mac App Store.

Sandboxing

Sandboxing is used to restrict what your app is able to access (such as file locations or hardware features). This serves as a security feature, because if an app were to become compromised for some reason then it would be unable to do as much damage as if it had full control of the computer.

Certificates and Code Signing

To be able to submit an app to the Mac App Store for Apple to review, you need to first create your Mac App Store certificates using the online Certificate Tool that is part of the Apple Dev Center. You also need to create a bundle ID for your app. When your app is complete, you then need to code sign your app (and all its dynamic libraries). You also need to create the installer and code sign that as well.

Finally you can create a submission using iTunes Connect, fill in all the required information and then upload your app using the Application Loader tool that is part of the Mac Development Tools. Once you have submitted something to the Mac App Store, it can several days before your app is approved by Apple and ready for sale.

Validating The Apple ID

The above steps work great for any apps, including free apps, but if you are selling your app, you will want to prevent people from copying the purchased app to another computer and running it there (without having to log into their Apple ID). To do this you also need to verify the Apple ID.

Verifying an AppleID requires calling a Cocoa API. The code is far too involved to include here, but the open-source MacOSLib project has classes that you can use for this.

Linux

Linux apps also have a variety of deployment options. The simplest is to use GZip and let the user put the app wherever they want. You can also use a tool such as InstallJammer that creates a generic installer that works with a variety of Linux platforms. Lastly, you can create separate installers for each Linux distribution. Common installer formats are deb (used by Debian and Ubuntu) and RPM (RedHat Package Maker) used by RedHat.

Generic Installer

InstallJammer is an open-source product that has a simple user interface for creating an installer that works on a variety of Linux distributions. Unfortunately, this tool is no longer being actively developed. However, it still works well and might be a good choice if you do not use Linux often enough to master creating dedicated installers.

Debian Installer

Debian installers are used by Debian-based Linux distributions, such as Ubuntu or Linux Mint. They can be installed by the Synaptic Package Maker or from the terminal.

You create Debian installers using the dpkg-deb terminal app. Its usage is far more involved than can be discussed here, but this tutorial describes how you can create a Debian package:

Redhat Installer

The Redhat installer format (RPM) is used by Redhat-based Linux distributions. You can create RPM installers using the rpmbuild terminal app. Its usage is far more involved than can be discussed here, although the Fedora Project does have a good walkthrough:

Zip

A Zip file is an archive of your app. A zip is easy to download and most users understand what they are. They can usually be unzipped by simply double-clicking on them, which reveals the app itself. The app can then be manually copied to where the user wants it.