Product Documentation

App layer

Jan 11, 2018

Before you start

This section explains what you need to create an App Layer, and what the options are for your layer. 


To create an App Layer, you need:


Before you create an App Layer, you may also want to create resources that facilitate the application installation process. These resources are for temporary use during installation only, and will not be used to deliver the application.

If the application you install affects boot-level components, you'll need to restart the Packaging Machine as part of finalizing the layer or version.

Prerequisite Layer

Prerequisite Layers let you include existing App Layers on the Packaging Disk when creating or adding a version to an App Layer. Prerequisite Layers should only be used if they are required, since it is possible that the prerequisite applications will pull something into the Layer that is not required for the current application deployment, and which may cause conflict in the future.

Reasons to consider using Prerequisite Layers:

  • The application you are installing requires another application during installation. For example, if you are installing an application that requires Java and you have Java in a separate layer.
  • The add-in or plugin you are installing adds settings to an application. For example, when installing an Office add-in, you would use your Microsoft Office App Layer as a prerequisite layer.
  • Two applications modify the same registry key, and the second application must add to an existing key rather than replace it. For example, Citrix Agent and Imprivata software both modify login keys in Windows.

Note: Some of these issues can also be handled by putting the two applications in the same layer.

Platform Layer (Only required if creating App Layers on a hypervisor other than the one from which you imported your OS Layer)

If you are creating App Layers and Versions on a different hypervisor than the one you used to create your OS Layer, you should consider creating a Platform Layer with the hypervisor tools and hardware settings that will make it easy to install and package applications in your environment.

Run Once Script

You can include a Run Once script in an App Layer. This allows you to run a script the first time any Layered Image that includes the App Layer boots. If the App Layer is elastically layered, the Run Once script runs when the App Layer Disk is mounted. Run Once scripts are typically used for apps, such as MS Office, that require license activation on the first boot.

Layer Caching for faster App Layer creation

If you will be creating multiple App Layers that use the same OS Layer, Prerquisite Layer(s), and Platform Layer, you can save significant time by setting the Layer Disk Cache Size in the vSphere Connector. If Cache Size is set to a value greater than 0, the first time you create an App Layer with a specific OS Layer, Prerequisite Layer(s) and Platform Layer, the App Layering software will save a template in the cache that consists of the boot disk and the empty packaging disk. The next time you create an App Layer that uses the same OS Layer, Prerequisite Layer(s) and Platform Layer, the App Layering software will re-use this template, thereby significantly cutting the time it takes to create this App Layer in half.

Please note that if you create an App Layer that uses a different OS Layer, Prerequisite Layer(s) or Platform Layers from what is saved in the template, the App Layering software will create a new template and store it in cache.

The size that you need to set for your cache depends on how many different combinations of OS Layers, Prerequisite Layer(s), Platform Layer combinations and therefore how many cached templates you will use as you layer various Apps. To estimate the space required for each template you can you can determine how much space a Boot disk will use by selecting the i for the OS Layer you are using and observing the Maximum Layer Size value in the Version Information section.

Likewise, you can obtain the Pkg disk size for an existing Application/Platform layer using the same approach. When creating new layers, you can set the Max Layer Size used by setting the Max Layer Size (GB) field in the Create Layer Wizard. By looking at the size of your existing layers, and estimating how many layers you are going to be creating/editing you can determine how large to set the Cache Size in your connector configuration.

Prepare a new App Layer

  1. Select Layers > App Layers and select Create Layer in the Action bar. This opens the Create Layer wizard.
  2. In the Version Details tab:
    1. (Required) Enter a name for the New Version. This can be the App version or other identifying information.
    2. For Base Version, select the version to use as the base for the new layer version. The default is the latest version. 
  3. In the OS Layer tab, select the OS Layer you want to associate with this App Layer.
  4. (Optional) In the Prerequisite Layers tab, if the application you are layering requires other App Layers to be present during installation, select the Include Prerequisite Layers check box, and pick the necessary App Layer(s).

    • Prerequisite layers are used while installing applications and are not included in the App Layer.
    • Prerequisite layers are not included by default when adding a new Version to this App Layer. So, when you add a new Version to this App Layer, you must choose the Prerequisite Layers again, if needed.
    • The App Layer you are creating and each of its Prerequisite Layers must be associated with the selected OS Layer.
  5. In the Connector tab, choose a Connector Configuration that includes the credentials for the platform where you plan to build the Layer, along with the storage location. If the configuration you need isn't listed, add a New Connector Configuration and select it from this list. 
    Example: If you're using the vSphere environment to create the Layer, select the vSphere connector with the credentials and location required to access the location where you want to build the Layer.
  6. In the Platform Layer tab you can select a Platform Layer containing the software, tools, and hardware settings that you need to install and package an application during layer creation. This selection is only used during layer creation. Once created, the Layer can be used in Layered Images published to any platform.
  7. In the Packaging Disk tab, enter a file name for the Packaging Disk, and select the disk format. This disk will be used for the Packaging Machine (the VM) where you will install the application, as described in the next two sections.
  8. In the Icon Assignment tab, select an icon to assign to the layer. This icon represents the layer in the Layers Module.
    • To use an existing image, select an image in the image box.
    • To import a new image, click Browse and select an image in PNG or JPG format.
  9. In the Confirm and Complete tab, review the details of the App Layer, enter a comment if required, and click Create Layer. Any comments you enter will appear in the Information view Audit History. Once the Packaging Disk has been created, the Task bar displays instructions to navigate to the Packaging Machine in vSphere..

Next, you can log into the Packaging Machine for your Layer, and install the software for the layer on it.

Deploy a Packaging Machine

  1. Log into your hypervisor client.
  2. Back in the Management Console, expand the Tasks bar at the bottom of the UI, and double-click the Create App Layer task to see the full Task Description (example below).
  3. Use the instructions in the Task Description to navigate to the Packaging Machine in your hypervisor client.
  4. The Packaging Machine is powered on.

You can now install the applications for this layer on the Packaging Machine.

Install the software on the Packaging Machine

When you've completed the Layer wizard, Unidesk creates a Packaging Machine in your environment, in the location defined in the Connector Configuration. The Packaging Machine is a virtual machine where you install the software to be included in the layer.

Note: The Packaging Machine is a temporary VM that will be deleted once the new Platform Layer has been finalized.

Log onto the Packaging Machine

  1. Log into your vSphere web client 
  2. Back in the Unidesk Management Console, expand the Tasks bar at the bottom of the UI, and double-click the Create App Layer task to see the full Task Description.
  3. Use the instructions in the Task Description to navigate to the Packaging Machine in your vSphere web client.
    The Packaging Machine will be powered on.

Install the Application(s)

When installing your application(s) on the Packaging Machine, leave each application as you want users to see it when they log in. The state of the applications when you finalize the layer is what users experience when they access the application. More guidance about this is included in the steps below.

  1. Remote log in to the Packaging Machine in vSphere. Be sure to log in with the User account you used to create the OS in vSphere.
  2. Install the applications, along with any drivers, boot-level applications, or files that the user will need with it.
    If an application installation requires a system restart, restart it manually. The Packaging Machine does not restart automatically.
  3. Make sure the Packaging Machine is in the state you want it to be for the user:
    • If the applications you install require any post-installation setup or application registration, complete those steps now.
    • Remove any settings, configurations, files, mapped drives, or applications that you do not want to include on the Packaging Machine.

Verify the layer and shut down the Packaging Machine

Once the application is installed on the Packaging Machine, it is important to verify that the Layer is ready to be finalized. To be ready for finalization, any required post-installation processing needs to be completed. For example, a reboot may be required, or a Microsoft NGen process may need to complete.

To verify that any outstanding processes are complete, you can run the Shutdown For Finalize tool (icon below), which appears on the Packaging Machine's desktop.

To use the Shutdown For Finalize tool:

  1. If you are not logged into the Packaging Machine, remote log in as the user who created the machine.
  2. Double-click the Shutdown For Finalize icon. A command line window displays messages detailing the layer verification process.
  3. If there is an outstanding operation that must be completed before the Layer can be finalized, you are prompted to complete the process. For example, if a Microsoft NGen operation needs to complete, you may be able to expedite the NGen operation, as detailed below.
  4. Once any pending operations are complete, double-click the Shutdown For Finalize icon again. This shuts down the Packaging Machine.

The Layer is now ready to finalize.

Layer integrity messages you may see during the finalization process

Layer integrity messages let you know what queued tasks must be completed before a Layer is finalized.

The new Layer or Version can only be finalized when the following conditions have been addressed:

  • A reboot is pending to update drivers on the boot disk - please check and reboot the Packaging Machine.
  • A post-installation reboot is pending - please check and reboot the Packaging Machine.
  • An MSI install operation is in progress - please check the Packaging Machine.
  • A Microsoft NGen operation is in progress in the background.
    Note: If a Microsoft NGen operation is in progress, you may be able to expedite it, as described in the next section.

Expediting a Microsoft NGen operation

NGen is the Microsoft Native Image Generator. It is part of the .NET system, and basically re-compiles .NET byte code into native images and constructs the registry entries to manage them. Windows will decide when to run NGen, based on what is being installed and what Windows detects in the configuration. When NGen is running, you must let it complete. An interrupted NGen operation can leave you with non-functioning .NET assemblies or other problems in the .NET system.

You have the choice of waiting for the NGen to complete in the background, or you can force the NGen to the foreground. You can also check the status of the NGen operation, as described below. However, every time you check the queue status, you are creating foreground activity, which might cause the background processing to temporarily pause.

Forcing the NGen to the foreground will allow you to view the progress and once the output has completed, you should be able to finalize the layer.

  1. Force an NGen operation to the foreground.
    Normally, NGen is a background operation and pauses if there is foreground activity. Bringing the task into the foreground can help the task to complete as quickly as possible. To do this:
    1. Open a command prompt as Administrator.
    2. Go to the Microsoft .NET Framework directory for the version currently in use:
    3. cd C:\Windows\Microsoft.NET\FrameworkNN\vX.X.XXXXX
    4. Enter the NGen command to execute the queued items:
    5. ngen update /force
    6. This brings the NGen task to the foreground in the command prompt, and lists the assemblies being compiled.
    7. Note: It’s okay if you see several compilation failed messages!
      Look in the Task Manager to see if an instance of MSCORSVW.EXE is running. If it is, you must allow it to complete, or re-run ngen update /force. Do not reboot to stop the task. You must allow it to complete.
  2. Check the status of an NGen operation
    1. Open a command prompt as Administrator.
    2. Check status by running this command:
      ngen queue status
    3. When you receive the following status, the NGen is complete, and you can finalize the Layer.
      The .NET Runtime Optimization Service is stopped

Finalize the Layer

Once the software has been installed and the Packaging Machine has been verified and shut down, you are ready to finalize the layer.

Note: When you finalize a Layer, Unidesk may delete the Packaging Machine to minimize storage space used.

When the Layer has been verified and is ready to finalize:

  1. Return to the Management Console.
  2. Select Layers >App Layers, and then the layer you just prepared.
  3. Select Finalize in the Action bar. The Finalize wizard appears.
  4. (Optional) On the Script Path wizard tab, you can enter the path to a Run Once Script located on a server on your network.
    • If the App Layer is elastically assigned, the Run Once script will be executed the first time the app is used.
    • If the App Layer is included in a Layered Image, the Run Once script will be executed the first time the Layered Image is booted.
  5. Click Finalize to finish creating the Layer.
  6. Monitor the Task bar to verify that the action completes successfully and that the Layer is ready to be deployed.