8

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

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
m1l0s
  • 83
  • 4

1 Answers1

8

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

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
  • As you can see in the screenshot even in WinApps\ there is programname.exe. In there I see also directory belonging to the program with again programname.exe in there, but adding that path in Executable still does not work. The same error shows even if I cd into that directory and try to run it. I have tried adding that the full path with both uap3 and uap5 extensions without success. IF I mistype program name I get different error. I have also tried adding actual exe name and alias name. – m1l0s Mar 30 '19 at 23:52
  • I have shared my working test project in my answer. Please compare that with yours. If it still doesn't work, please share your project that shows the problem so we have a complete repro to look at. Otherwise we can only speculate. – Stefan Wick MSFT Mar 31 '19 at 00:54
  • 1
    It worked but I had to set `Executable="PROJNAME\EXENAME.exe"`. That was unexpected as the exe is directly in the bin directory and I don't have any folders called PROJNAME (same as its namespace). I am guessing packaging process created the folder and moves content there – m1l0s Apr 01 '19 at 21:53