共用方式為


About App-V 5.0 Dynamic Configuration

You can use the dynamic configuration to customize an App-V 5.0 package for a user. Use the following information to create or edit an existing dynamic configuration file.

When you edit the dynamic configuration file it customizes how an App-V 5.0 package runs for a user or group. This helps to provide a more convenient method for package customization by removing the need to resequence packages using the desired settings, and provides a way to keep package content and custom settings independent.

Advanced: Dynamic Configuration

Virtual application packages contain a manifest that provides all the core information for the package. This information includes the defaults for the package settings and determines settings in the most basic form (with no other customization). If you want to adjust these defaults for a particular user or group, you can create and edit the following files:

  • User Configuration file

  • Deployment configuration file

The previous .xml files specify package settings and allow for packages to be customized without directly affecting the packages. When a package is created, the sequencer automatically generates default deployment and user configuration .xml files using the package manifest data. Therefore, these automatically generated configuration files simply reflect the default settings that the package innately as from how things were configured during sequencing. If you apply these configuration files to a package in the form generated by the sequencer, the packages have the same default settings that came from their manifest. This provides you with a package-specific template to get started if any of the defaults must be changed.

Note

The following information can only be used to modify sequencer generated configuration files to customize packages to meet specific user or group requirements.

Dynamic Configuration file contents

All of the additions, deletions, and updates in the configuration files need to be made in relation to the default values specified by the package's manifest information. Review the following list:

  • User Configuration .xml file
  • Deployment Configuration .xml file
  • Package Manifest

The previous list represents how the files will be read. The first entry represents what will be read last, therefore, its content takes precedence. Therefore, all packages inherently contain and provide default settings from the package manifest. If a deployment configuration .xml file with customized settings is applied, it overrides the package manifest defaults. If a user configuration .xml file with customized settings is applied prior to that, it overrides both the deployment configuration and the package manifest defaults.

The following list displays more information about the two file types:

  • User Configuration File (UserConfig) - Allows you to specify or modify custom settings for a package. These settings are applied for a specific user when the package is deployed to a computer running the App-V 5.0 client.

  • Deployment Configuration File (DeploymentConfig) - Allows you to specify or modify the default settings for a package. These settings are applied for all users when a package is deployed to a computer running the App-V 5.0 client.

To customize the settings for a package for a specific set of users on a computer or to make changes that will be applied to local user locations such as HKCU, the UserConfig file should be used. To modify the default settings of a package for all users on a machine or to make changes that will be applied to global locations such as HKEY_LOCAL_MACHINE and the all users folder, the DeploymentConfig file should be used.

The UserConfig file provides configuration settings that can be applied to a single user without affecting any other users on a client:

  • Extensions that are integrated into the native system per user:- shortcuts, File-Type associations, URL Protocols, AppPaths, Software Clients and COM

  • Virtual Subsystems:- Application Objects, Environment variables, Registry modifications, Services and Fonts

  • Scripts (User context only)

  • Managing Authority (for controlling coexistence of package with App-V 4.6)

The DeploymentConfig file provides configuration settings in two sections, one relative to the machine context and one relative to the user context providing the same capabilities listed in the UserConfig list above:

  • All UserConfig settings above

  • Extensions that can only be applied globally for all users.

  • Virtual Subsystems that can be configured for global machine locations, for example, registry.

  • Product Source URL

  • Scripts (Machine context only)

  • Controls to Terminate Child Processes

File structure

The structure of the App-V 5.0 Dynamic Configuration file is explained in the following section.

Dynamic User Configuration file

Header - the header of a dynamic user configuration file is as follows:

<?xml version="1.0" encoding="utf-8"?><UserConfiguration **PackageId**="1f8488bf-2257-46b4-b27f-09c9dbaae707" DisplayName="Reserved" xmlns="<https://schemas.microsoft.com/appv/2010/userconfiguration">

The PackageId is the same value as exists in the Manifest file.

Body - the body of the Dynamic User Configuration file can include all the app extension points that are defined in the Manifest file, and information to configure virtual applications. There are four subsections allowed in the body:

  1. Applications
  2. Subsystems
  3. UserScripts
  4. ManagingAuthority

Applications

All app-extensions that are contained in the Manifest file within a package are assigned with an Application ID, which is also defined in the manifest file. This allows you to enable or disable all the extensions for a given application within a package. The Application ID must exist in the Manifest file or it will be ignored.

<UserConfiguration **PackageId**="1f8488bf-2257-46b4-b27f-09c9dbaae707" DisplayName="Reserved" xmlns="<https://schemas.microsoft.com/appv/2010/userconfiguration">

<Applications>

<!-- No new application can be defined in policy. AppV Client will ignore any application ID that is not also in the Manifest file -->

<Application Id="{a56fa627-c35f-4a01-9e79-7d36aed8225a}" Enabled="false">

</Application>

</Applications>

...

</UserConfiguration>

Subsystems

AppExtensions and other subsystems are arranged as subnodes under the <Subsystems>:

<UserConfiguration **PackageId**="1f8488bf-2257-46b4-b27f-09c9dbaae707" DisplayName="Reserved" xmlns="<https://schemas.microsoft.com/appv/2010/userconfiguration">
  <Subsystems>
  ...
  </Subsystems>
  ...
</UserConfiguration>

Each subsystem can be enabled/disabled using the Enabled attribute. Below are the various subsystems and usage samples.

Extensions:

Some subsystems (Extension Subsystems) control Extensions. Those subsystems are:- shortcuts, File-Type associations, URL Protocols, AppPaths, Software Clients and COM

Extension Subsystems can be enabled and disabled independently of the content. If Shortcuts are enabled, the client uses the shortcuts contained within the manifest by default. Each Extension Subsystem can contain an <Extensions> node. If this child element is present, the client ignores the content in the Manifest file for that subsystem, and only use the content in the configuration file.

Example using the shortcuts subsystem:

  1. If the user defined this in either the dynamic or deployment config file, then content in the manifest will be ignored.

    <Shortcuts  Enabled="true">
      <Extensions>
        ...
      </Extensions>
    </Shortcuts>
    
  2. If the user defined only the following element, then the content in the Manifest will be integrated during publishing.

    <Shortcuts  Enabled="true"/>
    
  3. If the user defines the following element, then all the shortcuts within the manifest will still be ignored. There will be no shortcuts integrated.

    <Shortcuts  Enabled="true">
      <Extensions/>
    </Shortcuts>
    

The supported Extension Subsystems are:

  • Shortcuts: This controls shortcuts that will be integrated into the local system. Below is a sample with two shortcuts:

    <Subsystems>
    <Shortcuts Enabled="true">
     <Extensions>
       <Extension Category="AppV.Shortcut">
         <Shortcut>
           <File>\[{Common Programs}\]\\Microsoft Contoso\\Microsoft ContosoApp Filler 2010.lnk</File>
           <Target>\[{PackageRoot}\]\\Contoso\\ContosoApp.EXE</Target>
           <Icon>\[{Windows}\]\\Installer\\{90140000-0011-0000-0000-0000000FF1CE}\\inficon.exe</Icon>
           <Arguments />
           <WorkingDirectory />
           <AppUserModelId>ContosoApp.Filler.3</AppUserModelId>
           <Description>Fill out dynamic forms to gather and reuse information throughout the organization using Microsoft ContosoApp.</Description>
           <Hotkey>0</Hotkey>
           <ShowCommand>1</ShowCommand>
           <ApplicationId>\[{PackageRoot}\]\\Contoso\\ContosoApp.EXE</ApplicationId>
         </Shortcut>
     </Extension>
     <Extension Category="AppV.Shortcut">
       <Shortcut>
         <File>\[{AppData}\]\\Microsoft\\Contoso\\Recent\\Templates.LNK</File>
         <Target>\[{AppData}\]\\Microsoft\\Templates</Target>
         <Icon />
         <Arguments />
         <WorkingDirectory />
         <AppUserModelId />
         <Description />
         <Hotkey>0</Hotkey>
         <ShowCommand>1</ShowCommand>
         <!-- Note the ApplicationId is optional -->
       </Shortcut>
     </Extension>
    </Extensions>
    </Shortcuts>
    
  • File-Type Associations: Associates File-types with programs to open by default and setup the context menu. (MIME types can also be setup using this subsystem). Sample File-type Association:

    <FileTypeAssociations Enabled="true">
    <Extensions>
     <Extension Category="AppV.FileTypeAssociation">
       <FileTypeAssociation>
         <FileExtension MimeAssociation="true">
         <Name>.docm</Name>
         <ProgId>contosowordpad.DocumentMacroEnabled.12</ProgId>
         <PerceivedType>document</PerceivedType>
         <ContentType>application/vnd.ms-contosowordpad.document.macroEnabled.12</ContentType>
         <OpenWithList>
           <ApplicationName>wincontosowordpad.exe</ApplicationName>
         </OpenWithList>
        <OpenWithProgIds>
           <ProgId>contosowordpad.8</ProgId>
         </OpenWithProgIds>
         <ShellNew>
           <Command />
           <DataBinary />
           <DataText />
           <FileName />
           <NullFile>true</NullFile>
           <ItemName />
           <IconPath />
           <MenuText />
           <Handler />
         </ShellNew>
       </FileExtension>
       <ProgId>
          <Name>contosowordpad.DocumentMacroEnabled.12</Name>
           <DefaultIcon>\[{Windows}\]\\Installer\\{90140000-0011-0000-0000-0000000FF1CE}\\contosowordpadicon.exe,15</DefaultIcon>
           <Description>Blah Blah Blah</Description>
           <FriendlyTypeName>\[{FOLDERID\_ProgramFilesX86}\]\\Microsoft Contoso 14\\res.dll,9182</FriendlyTypeName>
           <InfoTip>\[{FOLDERID\_ProgramFilesX86}\]\\Microsoft Contoso 14\\res.dll,1424</InfoTip>
           <EditFlags>0</EditFlags>
           <ShellCommands>
             <DefaultCommand>Open</DefaultCommand>
             <ShellCommand>
                <ApplicationId>{e56fa627-c35f-4a01-9e79-7d36aed8225a}</ApplicationId>
                <Name>Edit</Name>
                <FriendlyName>&Edit</FriendlyName>
                <CommandLine>"\[{PackageRoot}\]\\Contoso\\WINcontosowordpad.EXE" /vu "%1"</CommandLine>
             </ShellCommand>
             </ShellCommand>
               <ApplicationId>{e56fa627-c35f-4a01-9e79-7d36aed8225a}</ApplicationId>
               <Name>Open</Name>
               <FriendlyName>&Open</FriendlyName>
               <CommandLine>"\[{PackageRoot}\]\\Contoso\\WINcontosowordpad.EXE" /n "%1"</CommandLine>
               <DropTargetClassId />
               <DdeExec>
                 <Application>mscontosowordpad</Application>
                 <Topic>ShellSystem</Topic>
                 <IfExec>\[SHELLNOOP\]</IfExec>
                 <DdeCommand>\[SetForeground\]\[ShellNewDatabase "%1"\]</DdeCommand>
               </DdeExec>
             </ShellCommand>
           </ShellCommands>
         </ProgId>
        </FileTypeAssociation>
      </Extension>
     </Extensions>
     </FileTypeAssociations>
    
  • URL Protocols: This controls the URL Protocols that are integrated into the local registry of the client machine for example "mailto:".

    <URLProtocols Enabled="true">
    <Extensions>
    <Extension Category="AppV.URLProtocol">
    <URLProtocol>
     <Name>mailto</Name>
     <ApplicationURLProtocol>
     <DefaultIcon>\[{ProgramFilesX86}\]\\Microsoft Contoso\\Contoso\\contosomail.EXE,-9403</DefaultIcon>
     <EditFlags>2</EditFlags>
     <Description />
     <AppUserModelId />
     <FriendlyTypeName />
     <InfoTip />
    <SourceFilter />
     <ShellFolder />
     <WebNavigableCLSID />
     <ExplorerFlags>2</ExplorerFlags>
     <CLSID />
     <ShellCommands>
     <DefaultCommand>open</DefaultCommand>
     <ShellCommand>
     <ApplicationId>\[{ProgramFilesX86}\]\\Microsoft Contoso\\Contoso\\contosomail.EXE</ApplicationId>
     <Name>open</Name>
     <CommandLine>\[{ProgramFilesX86}\\Microsoft Contoso\\Contoso\\contosomail.EXE" -c OEP.Note /m "%1"</CommandLine>
     <DropTargetClassId />
     <FriendlyName />
     <Extended>0</Extended>
     <LegacyDisable>0</LegacyDisable>
     <SuppressionPolicy>2</SuppressionPolicy>
      <DdeExec>
     <NoActivateHandler />
     <Application>contosomail</Application>
     <Topic>ShellSystem</Topic>
     <IfExec>\[SHELLNOOP\]</IfExec>
     <DdeCommand>\[SetForeground\]\[ShellNewDatabase "%1"\]</DdeCommand>
     </DdeExec>
     </ShellCommand>
     </ShellCommands>
     </ApplicationURLProtocol>
     </URLProtocol>
     </Extension>
     </Extension>
     </URLProtocols>
    
  • Software Clients: Allows the app to register as an Email client, news reader, media player and makes the app visible in the Set Program Access and Computer Defaults UI. In most cases you should only need to enable and disable it. There's also a control to enable and disable the email client specifically if you want the other clients still enabled except for that client.

     <SoftwareClients Enabled="true">
       <ClientConfiguration EmailEnabled="false" />
     </SoftwareClients>
    
  • AppPaths: If an application for example contoso.exe is registered with an apppath name of "myapp", it allows you to type "myapp" under the run menu, and it opens contoso.exe.

     <AppPaths Enabled="true">
     <Extensions>
     <Extension Category="AppV.AppPath">
     <AppPath>
       <ApplicationId>\[{ProgramFilesX86}\]\\Microsoft Contoso\\Contoso\\contosomail.EXE</ApplicationId>
       <Name>contosomail.exe</Name>
       <ApplicationPath>\[{ProgramFilesX86}\]\\Microsoft Contoso\\Contoso\\contosomail.EXE</ApplicationPath>
       <PATHEnvironmentVariablePrefix />
       <CanAcceptUrl>false</CanAcceptUrl>
       <SaveUrl />
     </AppPath>
     </Extension>
     </Extensions>
     </AppPaths>
    
  • COM: Allows an Application to register Local COM servers. Mode can be Integration, Isolated, or Off.

     <COM Mode="Isolated"/>
    
  • Other Settings:

    In addition to Extensions, other subsystems can be enabled/disabled and edited:

    • Virtual Kernel Objects: <Objects Enabled="false" />

    • Virtual Registry: Used if you want to set a registry in the Virtual Registry within HKCU.

      <Registry Enabled="true">
      <Include>
      <Key Path="\\REGISTRY\\USER\\\[{AppVCurrentUserSID}\]\\Software\\ABC">
      <Value Type="REG\_SZ" Name="Bar" Data="NewValue" />
        </Key>
         <Key Path="\\REGISTRY\\USER\\\[{AppVCurrentUserSID}\]\\Software\\EmptyKey" />
        </Include>
         <Delete>
         </Registry>
      
    • Virtual File System: <FileSystem Enabled="true" />

    • Virtual Fonts: <Fonts Enabled="false" />

    • Virtual Environment Variables

      <EnvironmentVariables Enabled="true">
      <Include>
            <Variable Name="UserPath" Value="%path%;%UserProfile%" />
            <Variable Name="UserLib" Value="%UserProfile%\\ABC" />
            </Include>
           <Delete>
            <Variable Name="lib" />
             </Delete>
             </EnvironmentVariables>
      
    • Virtual services: <Services Enabled="false" />

UserScripts

Scripts can be used to set up or alter the virtual environment and execute scripts at time of deployment or removal, before an application executes, or they can be used to "clean up" the environment after the application terminates. Reference a sample User configuration file that is output by the sequencer to see a sample script. The Scripts section below provides more information on the various triggers that can be used.

ManagingAuthority

Can be used when two versions of your package are coexisting on the same machine, one deployed to App-V 4.6 and the other deployed on App-V 5.0. To Allow App-V vNext to take over App-V 4.6 extension points for the named package enter the following in the UserConfig file, where PackageName is the Package GUID in App-V 4.6:

  <ManagingAuthority TakeoverExtensionPointsFrom46="true" PackageName="032630c0-b8e2-417c-acef-76fc5297fe81" />

Dynamic Deployment Configuration file

Header - The header of a Deployment Configuration file is as follows:

<?xml version="1.0" encoding="utf-8"?><DeploymentConfiguration PackageId="1f8488bf-2257-46b4-b27f-09c9dbaae707" DisplayName="Reserved" xmlns="<https://schemas.microsoft.com/appv/2010/deploymentconfiguration">

The PackageId is the same value as exists in the manifest file.

Body - The body of the deployment configuration file includes two sections:

  • User Configuration section -allows the same content as the User Configuration file described in the previous section. When the package is published to a user, any app extensions configuration settings in this section override corresponding settings in the Manifest within the package unless a user configuration file is also provided. If a UserConfig file is also provided, it is used instead of the User settings in the deployment configuration file. If the package is published globally, then only the contents of the deployment configuration file will be used in combination with the manifest.

  • Machine Configuration section-contains information that can be configured only for an entire machine, not for a specific user on the machine. For example, HKEY_LOCAL_MACHINE registry keys in the VFS.

<DeploymentConfiguration PackageId="1f8488bf-2257-46b4-b27f-09c9dbaae707" DisplayName="Reserved" xmlns="<https://schemas.microsoft.com/appv/2010/deploymentconfiguration">
<UserConfiguration>
  ..
</UserConfiguration>
<MachineConfiguration>
..
</MachineConfiguration>
..
</MachineConfiguration>
</DeploymentConfiguration>

User Configuration - use the previous Dynamic User Configuration file section for information on settings that are provided in the user configuration section of the Deployment Configuration file.

Machine Configuration - the Machine configuration section of the Deployment Configuration File is used to configure information that can be set only for an entire machine, not for a specific user on the computer. For example, HKEY_LOCAL_MACHINE registry keys in the Virtual Registry. There are four subsections allowed in under this element:

  1. Subsystems
  2. ProductSourceURLOptOut
  3. MachineScripts
  4. TerminateChildProcess

Subsystems

AppExtensions and other subsystems are arranged as subnodes under <Subsystems>:

    <MachineConfiguration>
      <Subsystems>
      ..
      </Subsystems>
    ..
    </MachineConfiguration>

The following section displays the various subsystems and usage samples.

Extensions:

Some subsystems (Extension Subsystems) control Extensions, which can only apply to all users. The subsystem is application capabilities. Because this can only apply to all users, the package must be published globally in order for this type of extension to be integrated into the local system. The same rules for controls and settings that apply to the Extensions in the User Configuration also apply to those in the MachineConfiguration section.

Application Capabilities:

Used by default programs in windows operating system Interface. Allows an application to register itself as capable of opening certain file extensions, as a contender for the start menu internet browser slot, as capable of opening certain windows MIME types. This extension also makes the virtual application visible in the Set Default Programs UI:

    <ApplicationCapabilities Enabled="true">
      <Extensions>
       <Extension Category="AppV.ApplicationCapabilities">
        <ApplicationCapabilities>
         <ApplicationId>\[{PackageRoot}\]\\LitView\\LitViewBrowser.exe</ApplicationId>
         <Reference>
          <Name>LitView Browser</Name>
          <Path>SOFTWARE\\LitView\\Browser\\Capabilities</Path>
         </Reference>
       <CapabilityGroup>
        <Capabilities>
         <Name>@\[{ProgramFilesX86}\]\\LitView\\LitViewBrowser.exe,-12345</Name>
         <Description>@\[{ProgramFilesX86}\]\\LitView\\LitViewBrowser.exe,-12346</Description>
         <Hidden>0</Hidden>
         <EMailSoftwareClient>Lit View E-Mail Client</EMailSoftwareClient>
         <FileAssociationList>
          <FileAssociation Extension=".htm" ProgID="LitViewHTML" />
          <FileAssociation Extension=".html" ProgID="LitViewHTML" />
          <FileAssociation Extension=".shtml" ProgID="LitViewHTML" />
         </FileAssociationList>
         <MIMEAssociationList>
          <MIMEAssociation Type="audio/mp3" ProgID="LitViewHTML" />
          <MIMEAssociation Type="audio/mpeg" ProgID="LitViewHTML" />
         </MIMEAssociationList>
        <URLAssociationList>
          <URLAssociation Scheme="http" ProgID="LitViewHTML.URL.http" />
         </URLAssociationList>
         </Capabilities>
      </CapabilityGroup>
       </ApplicationCapabilities>
      </Extension>
    </Extensions>
    </ApplicationCapabilities>

Other Settings:

In addition to Extensions, other subsystems can be edited:

  • Machine Wide Virtual Registry: Used when you want to set a registry key in the virtual registry within HKEY_Local_Machine

      <Registry>
      <Include>
        <Key Path="\\REGISTRY\\Machine\\Software\\ABC">
          <Value Type="REG\_SZ" Name="Bar" Data="Baz" />
         </Key>
        <Key Path="\\REGISTRY\\Machine\\Software\\EmptyKey" />
       </Include>
      <Delete>
      </Registry>
    
  • Machine Wide Virtual Kernel Objects

      <Objects>
      <NotIsolate>
         <Object Name="testObject" />
       </NotIsolate>
      </Objects>
    

ProductSourceURLOptOut

Indicates whether the URL for the package can be modified globally through PackageSourceRoot (to support branch office scenarios). Default is false and the setting change takes effect on the next launch.

    <MachineConfiguration>
      ..
      <ProductSourceURLOptOut Enabled="true" />
      ..
    </MachineConfiguration>

MachineScripts

Package can be configured to execute scripts at time of deployment, publishing or removal. Reference a sample deployment configuration file that is generated by the sequencer to see a sample script. The Scripts section below provides more information on the various triggers that can be used

TerminateChildProcess

An application executable can be specified, whose child processes are terminated when the application exe process is terminated.

    <MachineConfiguration>
      ..
      <TerminateChildProcesses>
        <Application Path="\[{PackageRoot}\]\\Contoso\\ContosoApp.EXE" />
        <Application Path="\[{PackageRoot}\]\\LitView\\LitViewBrowser.exe" />
        <Application Path="\[{ProgramFilesX86}\]\\Microsoft Contoso\\Contoso\\contosomail.EXE" />
      </TerminateChildProcesses>
      ..
    </MachineConfiguration>

Scripts

The following table describes the various script events and the context under which they can be run.

Script Execution Time Can be specified in Deployment Configuration Can be specified in User Configuration Can run in the Virtual Environment of the package Can be run in the context of a specific application Runs in system/user context: (Deployment Configuration, User Configuration)
AddPackage X (SYSTEM, N/A)
PublishPackage X X (SYSTEM, User)
UnpublishPackage X X (SYSTEM, User)
RemovePackage X (SYSTEM, N/A)
StartProcess X X X X (User, User)
ExitProcess X X X (User, User)
StartVirtualEnvironment X X X (User, User)
TerminateVirtualEnvironment X X (User, User)

Create a Dynamic Configuration file using an App-V 5.0 Manifest file

You can create the Dynamic Configuration file using one of three methods: either manually, using the App-V 5.0 Management Console or sequencing a package, which will be generated with two sample files.

For more information about how to create the file using the App-V 5.0 Management Console, see How to Create a Custom Configuration File by Using the App-V 5.0 Management Console.

To create the file manually, the information above in previous sections can be combined into a single file. We recommend you use files generated by the sequencer.

How to Apply the Deployment Configuration File by Using PowerShell

How to Apply the User Configuration File by Using PowerShell

Operations for App-V 5.0