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.

4

1 回答 1

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

于 2018-07-11T08:05:55.090 回答