m1l0s
m1l0s

Reputation: 93

How to properly set AppExecutionAlias so the program could be launched from command line?

The Package.appxmanifest for this WPF app has already set

<uap5:Extension Category="windows.appExecutionAlias" Executable="PROGRAMNAME.exe"
    EntryPoint="Windows.FullTrustApplication">
          <uap5:AppExecutionAlias>
            <uap5:ExecutionAlias Alias="PROGRAMNAME.exe" />
          </uap5:AppExecutionAlias>
        </uap5:Extension>

but when I try to run PROGRAMNAME from command line there is an error message

"The system cannot find the file ....WindowsApps..."

I can go to that WindowsApps directory and even though I see that file, running it gives me the same error.

I have also tried

<uap3:Extension
    Category="windows.appExecutionAlias"
    Executable="$targetnametoken$.exe"
    EntryPoint="Windows.FullTrustApplication">
          <uap3:AppExecutionAlias>
            <desktop:ExecutionAlias Alias="PROGRAMNAME.exe" />
          </uap3:AppExecutionAlias>
        </uap3:Extension>

Screenshot of command line output and dir content

Upvotes: 9

Views: 3231

Answers (1)

Stefan Wick  MSFT
Stefan Wick MSFT

Reputation: 13850

A couple of things to note and fix here:
1. 'Executable' needs to have the actual executable path. Typically the EXE is located in a sub folder that the VS packaging project creates
2. The $targetnametoken$ replacement won't work in extensions unfortunately. So you have to put the actual folder and file names here
3. The 'Alias' property can contain whatever name you want to use for launching your app, it could be it's actual executable name, or an alias of your choice

  <uap3:Extension
      Category="windows.appExecutionAlias"
      Executable="WpfApp4\WpfApp4.exe"
      EntryPoint="Windows.FullTrustApplication">
    <uap3:AppExecutionAlias>
      <desktop:ExecutionAlias Alias="foo.exe" />
    </uap3:AppExecutionAlias>
  </uap3:Extension>  

Sharing my working test project here:
https://1drv.ms/u/s!AovTwKUMywTNv7oKzN9nznoZmK6XSw

Upvotes: 12

Related Questions