4

I have used the Desktop App Converter to convert my Win32 application to .appx.

The converter failed to convert application icons correctly. Icon transparency was lost. While I have reported this (bug?) to Microsoft, meanwhile I'd like to try to convert the icons manually. And I want to generate the .appx manually (using the makeappx) in the end anyway. So I need to create the AppxManifest.xml.


Problem is that the AppxManifest.xml generated by the Desktop App Converter is not valid. All image paths point to non-existing files:

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
  ...
  <Properties>
    ...
    <Logo>Assets\AppStoreLogo.png</Logo>
  </Properties>
  <Resources>
    <Resource Language="en-us" />
    <Resource uap:Scale="100" />
    <Resource uap:Scale="125" />
    <Resource uap:Scale="150" />
    <Resource uap:Scale="200" />
    <Resource uap:Scale="400" />
  </Resources>
  ...
  <Applications>
    <Application Id="WinSCP" Executable="WinSCP.exe" EntryPoint="Windows.FullTrustApplication">
      <uap:VisualElements DisplayName="WinSCP" Description="WinSCP" BackgroundColor="transparent" Square150x150Logo="Assets\AppMedTile.png" Square44x44Logo="Assets\AppList.png">
        <uap:DefaultTile Wide310x150Logo="Assets\AppWideTile.png" Square310x310Logo="Assets\AppLargeTile.png" Square71x71Logo="Assets\AppSmallTile.png">

There are no files like AppStoreLogo.png (etc) in the Assets folders, there are files like:

AppStoreLogo.scale-100.png
AppStoreLogo.scale-125.png
AppStoreLogo.scale-150.png
AppStoreLogo.scale-200.png
AppStoreLogo.scale-400.png

So the makeappx fails to generate the .appx using the generated manifest.

While I can obviously fix the manifest by pointing the paths to the scale-100 variant of the images, I feel that this is not the correct way.

The scaled images are the for a reason, for sure.


I can see these image and scales related elements:

  • There's the <Resources> element in the manifest that lists all the scales.

  • There are also resources.*.pri files, which reference the scaled images.

    resources.pri
    resources.scale-100.pri
    resources.scale-125.pri
    resources.scale-150.pri
    resources.scale-200.pri
    

But I do not understand how this all goes together. What paths should I use in the manifest to maintain the scaled images?

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • By the way Martin, for OSS we have a program that gives you access to a free license of our top commercial edition, if you're interested. http://www.advancedinstaller.com/free-license.html – Bogdan Mitrache Feb 14 '17 at 14:11
  • Makeappx can use the /l switch to ignore the .scale... stuff on each file. Then you can build with makeappx. – chris84948 Apr 29 '17 at 21:45

4 Answers4

0

All the icons are put together by a .PRI file that must be present into the package and generated for those assets. You can try to use makepri to dump the .PRI files into XML format and see their content.

herman.smn
  • 1,214
  • 7
  • 9
0

If you need to make manual edits to your resources and rebuild your resources.pri, please refer to this white paper and sample:

https://learn.microsoft.com/en-us/windows/uwp/globalizing/using-mrt-for-converted-desktop-apps-and-games

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

However, the easiest way to manage the visual assets for your app package is to use the package manifest editor in Visual Studio 2017.

enter image description here

To use it for your converted app, create an empty UWP project and add the output of the conversion (incl. your appx manifest) in this project. Now you can use the editor to manage the visual assets, build your packages for store submission and much more. Here is a document that describes the process: https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net

Thanks, Stefan Wick - Windows Developer Platform

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
0

It was probably some glitch in earlier versions of makeappx.

When trying over a year later again, the makeappx can now compile the AppxManifest.xml generated by Desktop App Converter, even though it seems to be about the same as before.


(Desktop App Converter still fails to generate application icons correctly).

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

I managed to convert the WinSCP installer to an AppX package using Advanced Installer.

From this link you can download the package, with the correct icons from what I noticed. Just extract the contents of the package and check out the paths in the manifest.

You can also install and test the app with this package, just install the self-signed certificate first, with which the app was signed. (in a VM of course)

Customizing your package resources:

enter image description here

enter image description here

I built a new appx package that contains more resources, for different sizes. You can download it from the link above, I updated the source.

To get the PRI content you need to run the command: makepri.exe dump

Here is the resources.pri.xml content from the new package:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PriInfo>
 <ResourceMap name="MartinPrikryl.WinSCP" version="1.0" primary="true">
  <Qualifiers>
   <AlternateForm>UNPLATED</AlternateForm>
   <Scale>100,125,150,200,400</Scale>
   <TargetSize>256,48</TargetSize>
  </Qualifiers>
  <ResourceMapSubtree name="Files">
   <ResourceMapSubtree name="Assets">
    <NamedResource name="Store50x50Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/Store50x50Logo.png">
     <Candidate qualifiers="Scale-400" isDefault="true" type="Path">
      <Value>Assets\Store50x50Logo.scale-400.png</Value>
     </Candidate>
     <Candidate qualifiers="Scale-200" isDefault="true" type="Path">
      <Value>Assets\Store50x50Logo.scale-200.png</Value>
     </Candidate>
     <Candidate qualifiers="Scale-150" isDefault="true" type="Path">
      <Value>Assets\Store50x50Logo.scale-150.png</Value>
     </Candidate>
     <Candidate qualifiers="Scale-125" isDefault="true" type="Path">
      <Value>Assets\Store50x50Logo.scale-125.png</Value>
     </Candidate>
     <Candidate qualifiers="Scale-100" isDefault="true" type="Path">
      <Value>Assets\Store50x50Logo.scale-100.png</Value>
     </Candidate>
    </NamedResource>
    <NamedResource name="WinSCPSquare150x150Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/WinSCPSquare150x150Logo.png">
     <Candidate qualifiers="Scale-125" isDefault="true" type="Path">
      <Value>Assets\WinSCPSquare150x150Logo.scale-125.png</Value>
     </Candidate>
    </NamedResource>
    <NamedResource name="WinSCPSquare310x310Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/WinSCPSquare310x310Logo.png">
     <Candidate qualifiers="Scale-100" isDefault="true" type="Path">
      <Value>Assets\WinSCPSquare310x310Logo.scale-100.png</Value>
     </Candidate>
    </NamedResource>
    <NamedResource name="WinSCPSquare44x44Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/WinSCPSquare44x44Logo.png">
     <Candidate qualifiers="TargetSize-48" isDefault="true" type="Path">
      <Value>Assets\WinSCPSquare44x44Logo.targetsize-48.png</Value>
     </Candidate>
     <Candidate qualifiers="TargetSize-256, AlternateForm-UNPLATED" type="Path">
      <Value>Assets\WinSCPSquare44x44Logo.targetsize-256_altform-unplated.png</Value>
     </Candidate>
    </NamedResource>
    <NamedResource name="WinSCPSquare71x71Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/WinSCPSquare71x71Logo.png">
     <Candidate qualifiers="Scale-100" isDefault="true" type="Path">
      <Value>Assets\WinSCPSquare71x71Logo.scale-100.png</Value>
     </Candidate>
    </NamedResource>
    <NamedResource name="WinSCPWide310x150Logo.png" uri="ms-resource://MartinPrikryl.WinSCP/Files/Assets/WinSCPWide310x150Logo.png">
     <Candidate qualifiers="Scale-100" isDefault="true" type="Path">
      <Value>Assets\WinSCPWide310x150Logo.scale-100.png</Value>
     </Candidate>
    </NamedResource>
   </ResourceMapSubtree>
  </ResourceMapSubtree>
 </ResourceMap>
</PriInfo>

Here is the manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" IgnorableNamespaces="uap rescap" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
  <Identity Name="MartinPrikryl.WinSCP" ProcessorArchitecture="x64" Publisher="CN=Caphyon-sha2, OU=AdvancedInstaller, O=Caphyon, E=support@caphyon.net" Version="5.9.3.7136"/>
  <Applications>
    <Application Id="WinSCP" Executable="VFS\ProgramFilesX86\WinSCP\WinSCP.exe" EntryPoint="Windows.FullTrustApplication">
      <uap:VisualElements DisplayName="WinSCP" Description="WinSCP" BackgroundColor="transparent" Square150x150Logo="Assets\WinSCPSquare150x150Logo.png" Square44x44Logo="Assets\WinSCPSquare44x44Logo.png">
        <uap:InitialRotationPreference>
          <uap:Rotation Preference="portrait"/>
          <uap:Rotation Preference="landscape"/>
        </uap:InitialRotationPreference>
        <uap:DefaultTile Square310x310Logo="Assets\WinSCPSquare310x310Logo.png" Square71x71Logo="Assets\WinSCPSquare71x71Logo.png" Wide310x150Logo="Assets\WinSCPWide310x150Logo.png"/>
      </uap:VisualElements>
    </Application>
  </Applications>
  <Resources>
    <Resource Language="en-US"/>
  </Resources>
  <Capabilities>
    <rescap:Capability Name="runFullTrust"/>
  </Capabilities>
  <Properties>
    <DisplayName>WinSCP</DisplayName>
    <PublisherDisplayName>Martin Prikryl</PublisherDisplayName>
    <Logo>Assets\Store50x50Logo.png</Logo>
  </Properties>
  <Dependencies>
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0"/>
  </Dependencies>
</Package>
Bogdan Mitrache
  • 10,536
  • 19
  • 34
  • Thanks. True, it converted the icons better than the Desktop App Converter. But on the other hand, there are no scaled versions of the icons. – Martin Prikryl Feb 14 '17 at 12:52
  • Advanced Installer has a set of dedicated views that allow our users to customize the package resources, before they build the appx, as you can see in the images above. The tiny and medium icons are mandatory, so we generate them, as MSFT does too (they also try generate other sizes). However it is recommended you build your own icons and use those instead of the ones generated automatically, as the conversion process cannot be compared with the original ICO sources. – Bogdan Mitrache Feb 14 '17 at 14:07
  • Thanks. Though that did not help me to get an answer to my question. I see that the manifest generated by the Advanced Installer reference the 100% version of icons. If I add higher resolution icons, they are added to the `Assets` subfolder. But there's no reference to them in the manifest, not in the `.pri` files (contrary to the Desktop App Converter). After further testing the Advanced Installer stopped working. It's giving "Access violation" errors and other cryptic messages, so I gave up. – Martin Prikryl Feb 15 '17 at 08:22
  • I edited the post above, with a new sample appx and some manifest and pri files that list all the images. These are generated with version 13.6 of AI, that will be released this week (the ones from version 13.5 should look the same). Can you please send me the project file for which you got the access violation at bogdan@advancedinstaller.com? – Bogdan Mitrache Feb 15 '17 at 10:11