Skip to content

Features

Weatherlights edited this page Feb 4, 2025 · 17 revisions

The MSIX-Power-Wrapper includes many features which are documented in this section.

Process

Process can be used to run a process. It is needed to run the wrapped application.

<Process>
  <ArgsSelector>Edit</ArgsSelector> <!-- Optional -->
  <Filename>[APPDIR]\mymainapp.exe</Filename>
  <WorkingDirectory>[APPDIR]</WorkingDirectory>
  <Arguments>myargument [ARGS]</Arguments>
  <WaitForExit>true</WaitForExit>
</Process>
Filename The path to the EXE file you would like to run. This file can be in your package or somewhere else on the filesystem.
WorkingDirectory A path which specified the working directory of the application.
Arguments The arguments that should be passed to the application.
ArgsSelector This can be used to provide multiple Process elements and making the executing dependent on a special argument that is provided to the wrapper. To run the specific exe within the sample you would need to provide the parameter `[ARGSSELECTOR|Edit]` within the command line and use `[RESOLVED_ARGS]` within the arguments to make sure the parameter is not provided to the final application.
WaitForExit Normally the wrapper waits for the application to exit before it continues. With setting `WaitForExit` to `false` the wrapper continues its execution. If all processes have `WaitForExit`` set to `false` the wrapper will not execute post execution tasks. If the value is not set the wrapper will wait for the process to finish.

Virtual File (Copy file)

Virtual file is used to copy a file from one location to another. It is intended to be used to move initial configurations from the application folder to the user profile. You can use the variable [APPDIR] to reference the application directory and [APPDATA] to reference the users appdata folder.

<VirtualFile>
  <File>[APPDIR]\myconfig.ini</File>
  <Target>[APPDATA]\myconfig.ini</Target>
  <Overwrite>1</Overwrite>
</VirtualFile>
File The file that you want to copy. You can use the variable `[APPDIR]` to reference the application directory.
Target The target location to which you want to copy the file. Use the variable `[APPDATA]` to reference the users appdata folder
Overwrite Should the file be overwritten if it already exists. Set this to 1 for enabled and 0 for disabled (Default is 0).

Virtual Folder (Copy folder)

Virtual folder is used to copy a folder from one location to another. It is intended to be used to move initial configurations from the application folder to the user profile. You can use the variable [APPDIR] to reference the application directory and [APPDATA] to reference the users appdata folder.

<VirtualFolder>
  <Folder>[APPDIR]\MyFolder</Folder>
  <Target>[APPDATA]\MyFolder</Target>
</VirtualFolder>
Folder The folder that you want to copy. You can use the variable `[APPDIR]` to reference the application directory.
Target The target location to which you want to copy the folder. Use the variable `[APPDATA]` to reference the users appdata folder.

Environment Variable

Environment variable can be used to set an environment variable before executing the main application. The application will honor the environment variable just like it would do a normal environment variable. The variable is not available to applications outside of the msix container.

  <EnvironmentVariable>
    <Name>MYENVVARIABLE</Name>
    <Value>[APPDIR]\PathToSomethingImportant.ini</Value>
  </EnvironmentVariable>

In this sample the application can access an environment variable called MYENVVARIABLE which contains the path to an ini file within the application folder. You can use variables for the name and the value.

Name The name of the environment variable.
Value The value of the environment variable.

Registry Entry

You can use this node to create registry settings within the virtualized MSIX registry for a user. You can use it to preset registry keys for the user and preconfigure your application. Existing keys will be set and non existing keys will be created. Please note the the virtualization will break if the registry path is available outside of the application.

  <RegistryEntry>
    <Key>Software\Microsoft\Trace32</Key>
    <Attribute>Register File Types</Attribute>
    <Value>0</Value>
    <Type>String</Type>
    <Node>USER</Node>
  </RegistryEntry>

In this sample we set the configuration of the CMTrace log tool so it does not show the dialog to register itself as the default log file viewer. The wrapper will preset this setting so that the main application consumes the value.

Key The path to the key you want to set or create.
Attribute The attribute under the key you want to set or create.
Value The value of the attribute you want to set.
Type The data type of the attribute you want to create or set. This can be String for a text, DWord for a numeric value or Binary for binary data.
Node The registry hive you want to use. This should always be set to USER. To write machine registry keys use the MSIX registry.

AppInstaller Update Handler

The AppInstaller Update Handler is used to control automatic updates through the AppInstaller file format. It can display a dialog when an update is available and show the progress to the enduser while also restarting the application as soon as the update is finished. This way you can make sure updates are installed before your application is launched.

  <AppInstallerUpdateHandler>
     <WaitForUpdateSearchToFinish>true</WaitForUpdateSearchToFinish>
     <TreatAvailableUpdateAsMandatory>true</TreatAvailableUpdateAsMandatory>
     <RestartOnMandatoryUpdate>true</RestartOnMandatoryUpdate>
     <Message lang="default" caption="Titeltext deiner Nachricht">Nachricht an den Benutzer mit dem Hinweis, dass seine Anwendung aktualisiert wird.</Message>
     <Message lang="en" caption="Title of your message">Message to the user that shows him that the app is updating.</Message>
  </AppInstallerUpdateHandler>

Clone this wiki locally