[Guide] Create Portable Versions of Applications


Recommended Posts

Create Portable Versions of Applications

About This Guide

This guide will show you how to make portable versions of applications by yourself using one of two freeware programs, Cameyo and Evalazer. Portable software works by storing all of its settings and other files in the program directory. This means that you can store the program on a flash drive or any other portable storage and run it from any computer, complete with all of your settings. Portable software does not need to be installed, you simply launch the EXE to start the program.

Before trying to make a program portable yourself, first you should check to see if a portable version already exists. Check with the program vendor as many developers make portable versions of their software available, and also check websites such as PortableApps and winPenPack which provide portable versions of several programs.

For this guide, you will be expected to have some experience with virtual machines. If you don't, I suggest doing some research first before attempting to follow this guide. This is not a typical step-by-step guide. Rather, this guide contains some tips for configuring your virtual machine, but you are expected to know how to setup and configure a virtual machine yourself.

For this guide, I used VirtualBox for a virtual machine, and I used Windows XP x86 as the guest OS. Any virtual machine software and guest OS should work just fine, but the guide is tailored specifically to these two. There is also good reason to use Windows XP for packaging applications, which I explain why later on.

Not all programs can be made portable. A program may not work if it requires drivers, installs or utilizes services, or integrates with the operating system. There are many other reasons a program may not work, but the best way to figure out is just to try it and see if it does work. This guide will demonstrate two programs, Cameyo and Evalazer, which are both freeware. If a program doesn't work with one, try the other.

The procedures in this guide were derived from the VMWare Thinapp Manual.

Required Software

First, you will need the programs which will package your applications. You only need one of these programs, but it helps to have both as certain applications may work in one but not the other. I think Cameyo is the better software, so I suggest trying Cameyo first before trying Evalazer.

You will also need a virtual machine to act as a sandbox. Although one is not required, this is highly recommended. I explain why a bit later in this guide. I will be using VirtualBox for this guide, but any virtual machine software should work just fine. Just note that this guide is specifically tailored to VirtualBox and so it may be a bit easier to follow this guide if you use it instead.

If you don't want to use a virtual machine, there are alternate methods as well. These programs will sandbox the contents of your hard disk, and you simply need to reboot to undo any changes. However, it is still recommended that you use a virtual machine instead. In addition to these programs, you may also use Windows built-in System Restore.

Sandboxie will not work for this guide. Sandboxie has an issue in which the sandboxed folders and registry keys continue to an infinite depth. Due to how the programs package the applications, this will cause them to get stuck in an infinite loop until they crash or run out of memory.

If you want a program to use for following this guide, you can use Paint.NET. I use this program as an example for this guide. It works well with both Cameyo or Evalazer and is pretty easy to package, so it's a good choice if this is your first time following this guide.

Many programs are stored in ZIP, RAR, and 7Z archives. If you need a program to extract these files, you can use 7-Zip portable.

How the Programs Work

These programs are able to create portable versions of applications by using virtualization to sandbox them. They sandbox the registry and certain folders such as Application Data and Program Files. The sandbox is stored in the program directory, so when a sandboxed program attempts to write a file or registry key, the change is written to the sandbox folder instead.

For the portable applications to work properly, it should be allowed direct access to certain directories such as Desktop and Documents. For example, I am using Paint.NET for this guide, which is an image editor. I should be able to load and save images stored in personal folders. If these folders are sandboxed, then the original image will remain untouched and the modified image will be written to the sandbox folder instead. While I can always grab the file out of the sandbox folder manually, this is pretty inconvenient. Cameyo allows you to configure directory isolation, and I'll explain how to do that later in the guide.

These programs have an unusual way of packaging applications. They work by scanning your system to build a list of all the files and registry keys. After doing this, you must install and configure the program. Then it will scan your system again to find all files and registry keys that were created or modified. Anything that was created or modified will be packaged into a portable application. The reason for this method is that everything is captured, even if the installer requires you to reboot.

Cameyo packages the files into a single EXE, and the sandbox is stored in a sub-folder called VOS. Evalazer creates an EXE launcher and packages the files into a separate .EVD file. The sandbox is stored in a sub-folder called EvaBox by default, but you can rename this folder in the program. To launch the program, you simply need to load the EXE and the application starts immediately.

Why should I use a Virtual Machine?

1. The virtual machine acts as a sandbox. The programs package applications by finding all files and registry keys created by the installer. However, this requires actually installing the program, unsandboxed. By using a virtual machine, you can sandbox the installer, and after you package the application, you can use a snapshot to restore the virtual machine to its original state.

2. It is highly recommended to use a clean OS install. When you install an application, it may include other dependencies such as runtimes or DLLs which are required for the program to work. Other applications may also include these files. If these files already existed before the program was installed, they may not be included when packaging the program. Using a clean, unmodified OS everytime ensures that all dependencies required by the program are packaged, else the program may not work.

Why should I use Windows XP as the guest OS?

You do not have to use Windows XP for this guide, Vista and 7 may work just as well. However, there are a few reasons you may want to use XP for packaging applications.

Windows XP is an older operating system, therefore it includes fewer dependencies which are required for some programs to run. Windows Vista and 7 are newer operating systems which contain many of these dependencies already. Using Windows XP ensures that more dependencies are packaged with the application.

Windows Vista and 7 are backwards compatible with Windows XP. So if you install a program onto Windows XP first, it will most likely continue to work on Vista and 7. The same may not be true, if you packaged the application on Vista or 7 and then you try to run it on Windows XP.

If you're reading this guide, you probably don't use Windows XP anymore. However, a lot of computers still do. And the fact that you want to make a portable version of an application probably means you plan on running that program on other computers. If you might be running these programs on XP machines, then you may want to package your applications in it instead.

Tips for Configuring the Virtual Machine

This section only contains some tips for configuring a virtual machine. I'm not going to explain how to setup a virtual machine as that is not the point of this guide. If you don't know how to do that, I suggest learning how to do this before attempting to follow this guide. There are many resources on the internet which will teach you how to do this.

The most important thing to consider is how much resources to allocate for your virtual machine. You will need to be able to install, run, and configure the program. You must make sure you have enough RAM and hard drive space available to do this. These are my own recommendations, but the more resources you can allocate to the virtual machine, the better.

  • Windows XP - 512MB RAM, 10GB Hard Drive
  • Windows Vista, 7 - 1GB (1024MB) RAM, 20GB Hard Drive

Some applications may require video acceleration in order for you to install and run them. Enable 2D and 3D video acceleration, and spare as much video memory as possible.

post-57213-12866684970624.png

If you are using VirtualBox, you will have to configure a shared folder. The shared folder is needed in order to export your packaged applications from the virtual machine. If you are using VMWare or Virtual PC, you should be able to simply drag and drop files from the virtual machine.

post-57213-12866733210662.png

Tips for Configuring the Guest OS

When you first install your guest OS, it may ask you for a username and computer name. This information may be included in the portable application (it may be required for the program to run properly), so if you're concerned about your privacy, I suggest setting these to something vague. Personally, I set the username to VirtualBox and the computer name to VirtualBox-PC.

The first thing you should do after installing the guest OS is to disable Automatic Updates. This service can start at anytime, and it can affect the packaging of the application, so it's recommended to disable it. You can still run Windows Update manually.

There are some services which you should disable as well as Automatic Updates. These services tend to make unintended changes to the system, and these changes may be included with your packaged application.

  • Error Reporting Service
  • Indexing Service
  • Superfetch
  • System Restore Service
  • Windows Backup
  • Windows Defender
  • Windows Error Reporting Service
  • Windows Search

Refrain from installing unnecessary updates. For example, refrain from installing Windows Live. These updates may include dependencies used by other programs, so it's probably best not to install them.

Go ahead and install the latest service pack for your guest OS. This is a matter of compatibility, some programs will not work if you don't have the latest service pack installed.

Refrain from installing any other programs or making any changes to the guest OS. Using a clean, unmodified OS will increase your chances of successfully packaging an application. If you must, use portable applications only. For example, if you need a program to extract RAR or 7Z archives, I suggest using 7-Zip portable instead.

If you are using VirtualBox, you must install Guest Additions to use Shared Folders. You may have to do the same for VMWare and Virtual PC to enable drag and drop of files.

Tips for Packaging Applications

After doing the prescan for either program, consider saving a snapshot of the virtual machine at this time. This way, you can start up the guest OS, the prescan is already complete and you can start installing the program immediately.

After installing the program, run it, change a few settings, and do a few other things. This ensures that all of the program files are created. If you don't do this, the packager may not capture the location in which the settings are stored, and that location may not be sandboxed, meaning your program will not work properly.

After you've packaged the application, a good way to test it is to run it in the guest OS after restoring the snapshot. Remember this is a clean, unmodified OS installation, so if your program runs successfully here, then it will probably work on just about any computer.

I think Cameyo is the better program of the two, so I suggest always trying Cameyo first before trying Evalazer. I've personally had more success with Cameyo, and it has more features. You can configure which folders and registry keys are sandboxed, and you can edit a packaged EXE at anytime.

If you are using VirtualBox, I suggest creating a shortcut to your Shared folder for quick access.

Unfortunately, neither Cameyo or EvaLazer provide a simple way of updating portable applications. The best way is to either rebuild an application from scratch, or save a snapshot of the virtual machine after installing and configuring the program but before the postscan. For the latter, you will have to save a snapshot for each program you make a portable version of.

Step by Step Guide for Cameyo

Download Cameyo

Install Cameyo in the guest OS. You can launch the program from the Start Menu under Programs (All Programs) -> Cameyo.

Click Capture Installation to start the prescan. The scan is fairly fast and it shouldn't take any longer than 10-15 seconds. You will know when the scan completes when a window pops up in the bottom left of the screen.

post-57213-12866737013334.png

After the prescan completes, this is a good time to save a snapshot of the virtual machine. This way, you can start up the guest OS at anytime and the prescan is already complete.

Now you may install the program. If you have to extract or copy any files, remember to delete them afterwards because otherwise they may be included in the packaged EXE.

Important! After you install the program, start up the program, change a few settings, and do anything else that may create files. This is important to ensure that the packager captures the location of all of the program files, most importantly the location of the settings. If you don't, it may not sandbox all of the required files and prevent your program from running portably.

After you're done installing and configuring the program, click Install Done. This will start the postscan, which again should take no longer than 10-15 seconds.

post-57213-12866744694642.png

You're not done yet! By default, Cameyo will store the sandbox in Application Data. To fix this, start up Cameyo again, but this time click Edit existing package. The packaged EXE is stored in My Documents\Cameyo Packages, so navigate there and load the EXE.

post-57213-12866745642252.png

On the line where it says Data Storage, click Change to the right. This will pop up a window.

Here, you want to change the data storage location to Under the executable's directory, then click OK.

post-57213-12866747621677.png

You can change a few other things in the Package Editor as well. As you can see in the screenshot above, Cameyo did not capture the icon properly. If this happens to you, you can click Change icon and choose one yourself manually, including from an EXE file.

You can also check file and registry isolation in the other two tabs. I want my program to have access to my Desktop folder, so I chose %Common DesktopDirectory% and I changed the isolation level to Full access.

post-57213-12866750730683.png

Important! After you've done everything in the Package Editor, remember to click File -> Save to save any changes. You can startup the Package Editor anytime in the future to make any further changes to your packaged EXE.

Of course, you have to export the program. Browse to My Documents\Cameyo Packages to find the EXE. If you are using VirtualBox, copy the file to your Shared folder. If you're using VMWare or Virtual PC, you should be able to drag and drop the file.

When you execute the program, it will create a sub-folder called VOS. All of the sandboxed files and registry keys are stored under this directory. Files and folders are stored as is, while registry keys are stored in a database.

Step by Step Guide for Evalazer

Download EvaLazer

EvaLazer comes in a ZIP archive, so simply extract it to any location you wish. Then start EvaLazer.exe.

Choose a name for your portable application. For this example, I chose Paint .NET. Then on the toolbar, click Prescan -> Start Prescan. The prescan shouldn't take longer than 10-15 seconds.

After the prescan completes, this is a good time to save a snapshot of the virtual machine. This way, you can start up the guest OS at anytime and the prescan is already complete.

post-57213-12866762381614.png

Now you may install the program. If you have to extract or copy any files, remember to delete them afterwards because otherwise they may be included in the packaged EXE.

Important! After you install the program, start up the program, change a few settings, and do anything else that may create files. This is important to ensure that the packager captures the location of all of the program files, most importantly the location of the settings. If you don't, it may not sandbox all of the required files and prevent your program from running portably.

After you're done installing and configuring the program, click Postscan -> Start Postscan on the toolbar. This will start the postscan, which again should take no longer than 10-15 seconds.

post-57213-12867621436935.png

After the postscan completes, click Build Settings on the toolbar. You will see a list of files with checkboxes next to them, these are the programs or files which will be executed when starting the portable package. In this case, I want to check PaintDotNet.exe.

Important! By default, the Sandbox Path is set to Application Data. To set the path to the executable directory, replace %appdata% at the beginning with a single period. You may also change the name of this folder if you wish.

.\EvaBox

post-57213-12866766565841.png

Click Create Application on the toolbar to build the application. This will create an .EXE file for launching the program, and an .EVD file which contains all of the program files. Both files are required, so remember to keep them both! If you are using VirtualBox, copy both files to your Shared folder. If you're using VMWare or Virtual PC, you should be able to drag and drop the files.

When you execute the program, it will create a sub-folder called EvaBox by default, unless you changed the name. All of the sandboxed files and registry keys are stored under this directory. Files and folders are stored as is, while registry keys are stored in a database.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.