3

I have an Win32 application ported to UWP using desktop bridge.

The application has both GUI and command-line interface (separate executables).

I'd like to have an icon and execution alias for the GUI interface, but only execution alias for the command-line interface. I do not want to pollute the Start menu with an icon no one will ever use.

For that I've understood that the manifest needs to include two Application elements, one for the GUI and one for the command-line interface, as one Application can include only one AppExecutionAlias.

See also Create a Universal Windows Platform console app.

My idea was something like this:

<Applications>
  <!-- GUI -->
  <Application Id="MyApp" Executable="MyApp.exe" EntryPoint="Windows.FullTrustApplication">
    <!-- with icon -->
    <uap:VisualElements DisplayName="MyApp" Description="MyApp" ...>
      ...
    </uap:VisualElements>
    <!-- and execution alias -->
    <Extensions>
      <uap5:Extension Category="windows.appExecutionAlias"
          Executable="MyApp.exe" EntryPoint="Windows.FullTrustApplication">
        <uap5:AppExecutionAlias>
          <uap5:ExecutionAlias Alias="MyApp.exe" />
        </uap5:AppExecutionAlias>
      </uap5:Extension>
    </Extensions>
  </Application>

  <!-- Command-line interface -->
  <Application Id="MyApp-commandline" Executable="MyApp-commandline.exe"
      EntryPoint="Windows.FullTrustApplication">
    <!-- with execution alias only -->
    <Extensions>
      <uap5:Extension Category="windows.appExecutionAlias"
          Executable="MyApp-commandline.exe" EntryPoint="Windows.FullTrustApplication">
        <uap5:AppExecutionAlias>
          <uap5:ExecutionAlias Alias="MyApp-commandline.exe" />
        </uap5:AppExecutionAlias>
      </uap5:Extension>
    </Extensions>
  </Application>
</Applications>

But I cannot find out how (if even possible) to have Application with no icon, as it seems that the VisualElements part is mandatory. So the above manifest is invalid. Of it there's some trick to an additional another execution alias (for a different binary) to the (first and only) Application.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

1

Yes, the VisualElements part is mandatory as the file warned, we should follow the rules that the .Manifest file required. But if you don't want to have some Icons, you can try to provide a URI that doesn't refer a real image resource. Such as,

<uap:VisualElements
  DisplayName="ConsoleUWP"
  Square150x150Logo="Square150x150Logo.png"
  Square44x44Logo="Image.png"
  Description="ConsoleUWP"
  BackgroundColor="transparent">
  <uap:DefaultTile Wide310x150Logo="Image.png"/>
  <uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>

the Square44x44Logo, Square150x150Logo and Wide310x150Logo don't refer to correct URIs for images, but the uap:SplashScreen can not be configure a wrong URI, if you did that, it would get error.

---Update---

We can use the Applications element to specify one or more apps for the package, but every Application need the VisualElements part in the UWP .manefest file. So if you add another , you will need to add the Visual Elements as it required, your idea can not implement. Also note that although each package can contain one or more apps, packages that contain multiple apps won't pass the Store certification process, that is to say you can not publish to store.

On the other hand, you can try to create a package that includes both a Win32 and Universal Windows Platform (UWP) processes, and communicate between them via an AppService APIs. It use the FullTrustProcessLauncher extension but not another . You can try and see the sample:

https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/AppServiceBridgeSample

Breeze Liu - MSFT
  • 3,734
  • 1
  • 10
  • 13
  • Thanks for your answer. How reliable that is? It looks like a hack to me, that may break in future versions of Windows. – Martin Prikryl Jul 11 '18 at 08:28
  • Yes, it's a trick to implement no some icons. But the Icon is really required from the console UWP app's manifest. On other hand, it should be more reliable to create some transparent images resource and put them as the Icon reference. – Breeze Liu - MSFT Jul 11 '18 at 08:35
  • *"transparent images"* would still create a tile, just with no icon, won't it? – Martin Prikryl Jul 11 '18 at 08:38
  • Transparent image would still create a tile. UWP console app is still UWP app, the Icon images are necessary for UWP app, it would like the normal UWP app which must include minimum requirement for the image Tiles when you submit it to the store. – Breeze Liu - MSFT Jul 11 '18 at 08:48
  • Sure, I understand that there must be at least one app in the package with icons (for uninstallation purposes for example). But my point is that my package contains two executables. The GUI one will have an icon. But I do not want an icon for the console app. So it's not "UWP console app"-only package, as in linked MS doc. – Martin Prikryl Jul 11 '18 at 08:51
  • You idea seems can not work to add a new without the part in the manifest. Please see my Update part in my reply. – Breeze Liu - MSFT Jul 12 '18 at 06:10