MSIX appxmanifest missing shortcut, creates shortcut pointing to wrong folder

66 views Asked by At

I have a appxmanifest, and have added an extension to create a shortcut.

The Link Shortcut does not start the application and also does not have a valid icon.

Inspecting the shortcut that got created, the shortcut / link points to C:\AppNameFolderWithOutVersionAndRandomHash\AppName.exe

and not C:\Program Files\WindowsApps\AppNameWithVersionAndHash\AppName.exe

At some point this worked, but stopped for some reason. Also testing this on a machine that had the application installed previously works (uninstall reinstall keeps working), yet on a new clean Windows 11 machine (VM), the shortcut is not valid.

I suspect it has to do with the AppUserModelID ?

<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop7="http://schemas.microsoft.com/appx/manifest/desktop/windows10/7"
IgnorableNamespaces="uap rescap desktop7">  

  <Identity
    Name="MyApp"
    Publisher="CN=somename"
    Version="1.0.97.0" />

  <Properties>
    <DisplayName>AppName</DisplayName>
    <PublisherDisplayName>ThePublisher</PublisherDisplayName>
    <Logo>Images\StoreLogo.png</Logo>
  </Properties>

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
  </Dependencies>

  <Resources>
    <Resource Language="x-generate"/>
  </Resources>

  <Applications>
      <Application Id="MyApp"
      Executable="$targetnametoken$.exe"
      EntryPoint="$targetentrypoint$">
          <uap:VisualElements
            DisplayName="MyApp"
            Description="MyApp Description"
            BackgroundColor="transparent"
            Square150x150Logo="Images\Square150x150Logo.png"
            Square44x44Logo="Images\Square44x44Logo.png"
          >
          <!-- AppListEntry="none" -->
              <uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png"  Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png"/>
              <uap:SplashScreen Image="Images\SplashScreen.png" />
          </uap:VisualElements>

          <Extensions>
              <desktop7:Extension Category="windows.shortcut">
                  <desktop7:Shortcut
                      File="[{Programs}]\AppFolder\MyApp.lnk"
                      Icon="[{Package}]\AppFolder\MyApp.exe"
                      ExcludeFromShowInNewInstall="false" />
              </desktop7:Extension>
          </Extensions>

      </Application>
  </Applications>

  <Capabilities>
    <Capability Name="internetClient" />
    <rescap:Capability Name="runFullTrust" />
    <Capability Name="internetClientServer"/>
  </Capabilities>
</Package>

Update 1:

Updating this line from:

Icon="[{Package}]\AppFolder\MyApp.exe"

to:

Icon="AppFolder\MyApp.exe"

get's the icon working, but not the actual target exe.

After reading some more, the Executable is defined on the Parent element <desktop7:Extension but is optional. If I do define it as AppFolder\MyApp.exe it makes no difference. The resulting shortcut remains invalid, pointing to the wrong exe location.

0

There are 0 answers