我使用桌面应用转换器将我的Win32应用转换为.appx
。
转换器无法正确转换应用程序图标。图标透明度丢失了。虽然我向微软报告了这个(错误?),但我还是想尝试手动转换图标。我想最终手动生成.appx
(最后使用makeappx
)。所以我需要创建AppxManifest.xml
。
问题是Desktop App Converter生成的AppxManifest.xml
无效。所有图像路径都指向不存在的文件:
<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">
AppStoreLogo.png
文件夹中没有Assets
(等)等文件,有以下文件:
AppStoreLogo.scale-100.png
AppStoreLogo.scale-125.png
AppStoreLogo.scale-150.png
AppStoreLogo.scale-200.png
AppStoreLogo.scale-400.png
因此makeappx
无法使用生成的清单生成.appx
。
虽然我可以通过将路径指向图像的scale-100
变体来明显修复清单,但我觉得这不是正确的方法。
缩放图像肯定是有原因的。
我可以看到这些图像并缩放相关元素:
清单中的<Resources>
元素列出了所有比例。
还有resources.*.pri
个文件,它们引用了缩放图像。
resources.pri
resources.scale-100.pri
resources.scale-125.pri
resources.scale-150.pri
resources.scale-200.pri
但我不明白这一切是如何结合在一起的。 我应该在清单中使用哪些路径来维护缩放图像?
答案 0 :(得分:0)
所有图标都由.PRI文件放在一起,该文件必须存在于包中并为这些资产生成。您可以尝试使用makepri将.PRI文件转储为XML格式并查看其内容。
答案 1 :(得分:0)
如果您需要对资源进行手动编辑并重建资源。请参阅此白皮书和示例:
但是,管理应用包的可视资源的最简单方法是在Visual Studio 2017中使用包清单编辑器。
要将其用于转换的应用,请创建一个空的UWP项目,并在此项目中添加转换的输出(包括您的appx清单)。现在,您可以使用编辑器来管理可视资产,为商店提交构建包等等。 这是一个描述该过程的文档:https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net
谢谢, Stefan Wick - Windows开发人员平台
答案 2 :(得分:0)
早期版本的makeappx
可能有些小问题。
一年后再次尝试时,makeappx
现在可以编译Desktop App Converter生成的AppxManifest.xml
,即使它看起来和以前大致相同。
(桌面应用转换器仍然无法正确生成应用程序图标)。
答案 3 :(得分:-1)
我设法将WinSCP安装程序转换为AppX package using Advanced Installer。
从this link您可以下载包,并提供我注意到的正确图标。只需提取包的内容并检查清单中的路径。
您还可以使用此软件包安装和测试应用程序,只需先安装自签名证书,然后使用该证书签署应用程序。 (当然是)
自定义您的软件包资源:
我构建了一个新的appx包,其中包含更多不同大小的资源。您可以从上面的链接下载它,我更新了源代码。
要获取PRI内容,您需要运行命令:makepri.exe dump
以下是新软件包中的 resources.pri.xml 内容:
<?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>
这是清单:
<?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>