XML-based package building

<< Click to Display Table of Contents >>

Navigation:  Automated package builder (command-line) >

XML-based package building

In this chapter you will find a hands-on, step-by-step tutorial for using Cameyo's command-line builder. In just a few minutes you will become familiar with the command-line builder and capable of packaging your own virtual applications.

Step 1: Build your first virtual application

1.If you haven't already, download Cameyo (i.e. to directory c:\cameyo) and activate its license. Activating the license requires that you launch the Cameyo menu and login, just once.

2.Download Cameyo's sample command line XML, i.e. to directory c:\cameyo. (If the link appears blank in your browser, be sure to show the page source).

3.From the command line, go to directory c:\cameyo by entering "cd \cameyo", and then run: "c:\cameyo\Cameyo.exe -BuildPkg BuildPkgSample.xml".

4.Congratulations! You have just created your first virtual application: "Sample.exe" (in the same directory as Cameyo.exe).

5.Now launch Sample.exe and you will see that you can start the Calculator or Notepad.

Step 2: Explore your virtual application

1.Launch "Sample.exe -exec cmd.exe". This will open a command line from the virtual application's context.

2.In the command line, go to your Program Files directory ("cd \program files") and list all files ("dir").

3.There you can see a directory called "Sample". That directory and its files do not really exist, they are virtual! Enter the Sample directory ("cd Sample") and "dir" again.

4.Now you can see the two executable files from BuildPkgSample.xml, as if they were really there. That's how file system virtualization will be perceived by the applications you package.

cmd

File-system virtualization: your application will see directories and files that don't really exist

 

Now let's do the same exploratory tour with the registry:

1.Launch "Sample.exe -exec regedit.exe" (make sure no instance of Regedit is already running). Again, this will show you the registry from the virtual application's angle:

2.Browse to HKEY_CURRENT_USER\Software\Sample. In there you will see an item called "Version" whose value is "1.10.0.0", just like defined in Sample.xml. Again, this value does not really exist there.

3.Close Regedit and open the real one instead. Now you will see that this key and its values do not really exist but were merely virtualized to the Sample.exe application:

Regedit

Registry virtualization: your application sees things that do not truly exist

Step 3: Customize the application

1.Modify the IconFile and AppID properties, and rebuild. See how the changes affected your output executable.

2.Add FileSystem/File entries and Registry/Value entries, and rebuild. See the effects.

3.Change the Sandbox section as following, rebuild and see how your application is isolated differently:

 <Sandbox>

         <FileSystem access="Isolated" />

         <FileSystem path="%Personal%" access="Full" />

         <Registry access="Full" />

         <Registry path="MACHINE\Software\Microsoft" access="Isolated" />

 </Sandbox>

That's it!

You have now learned enough to get going with building your own virtual application. In the next chapter we will learn more about the different XML options.

Remember that you can use the BuildPkg command in any batch / scripting environment. Return code 0 means success, non-zero means failure.

 

Note: the actual process for the command line builder is named Packager.exe or Packager64.exe (Cameyo.exe simply executes it from the Cameyo's Program Files directory).

A more advanced example

Cameyo itself is packaged using the XML builder. Here is a portion of the XML which is used for building Cameyo:

<ZeroInstallerXml>

 <Properties>

         <Property AppID="Cameyo" />

         <Property FriendlyName="Cameyo" />

         <Property Version="2.1.968" />

         <Property IconFile="CameyoMenu.exe" />

         <Property StopInheritance="Packager.exe;Packager64.exe" />

         <Property VirtMode="DISK" />

         <Property StartingDir="Original" />

         <Property BuildOutput="[AppID].exe" />

         <Property CloudPkgId="1" />

         <Property AutoUpdate="https://online.cameyo.com/update.aspx" />

 </Properties>

 <FileSystem>

         <File source="AppVirtDll.dll" targetdir="%Program Files%\Cameyo" />

         <File source="AppVirtDll64.dll" targetdir="%Program Files%\Cameyo" />

         <File source="Loader.exe" targetdir="%Program Files%\Cameyo" />

         <File source="Packager.exe" targetdir="%Program Files%\Cameyo" autoLaunch="Capture an installation" />

         <File source="..\..\cameyo-opensrc\Release\PackageEditor.exe" targetdir="%Program Files%\Cameyo" />

         <File source="..\..\cameyo-opensrc\Release\PackageEditor.exe.config" targetdir="%Program Files%\Cameyo" />

         <File source="..\..\cameyo-opensrc\Release\CameyoSDK.NET.dll" targetdir="%Program Files%\Cameyo" />

         <File source="..\..\cameyo-opensrc\Release\Cameyo.OpenSrc.Common.dll" targetdir="%Program Files%\Cameyo" />

         <File source="CameyoMenu.exe" targetdir="%Program Files%\Cameyo" />

         <File source="CameyoMenu.exe.config" targetdir="%Program Files%\Cameyo" />

 </FileSystem>

 <Registry>

         <Key path="%CurrentUser%\Software\Cameyo">

                 <Value name="Version" string="[Version]" />

         </Key>

 </Registry>

 <Sandbox>

         <FileSystem access="Full" />

         <Registry access="Full" />

 </Sandbox>

</ZeroInstallerXml>