2017-02-10 26 views
4

我已经使用桌面应用程序转换器将我的Win32应用程序转换为.appx修复由Destop App生成的AppX清单中的缩放图像转换器

转换器无法正确转换应用程序图标。图标透明度丢失。虽然我已经向Microsoft报告过这个错误,但同时我想尝试手动转换图标。无论如何,我想手动生成.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"> 

有像Assets文件夹AppStoreLogo.png(等)没有文件,有喜欢的文件:

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

由马丁方式,OSS我们有一个程序,让您访问我们的顶级商业的免费许可版,如果你有兴趣。 http://www.advancedinstaller.com/free-license.html –

+0

Makeappx可以使用/ l开关忽略每个文件上的.scale ...内容。然后你可以用makeappx来构建。 – chris84948

回答

0

所有图标都放在一个.PRI文件中,该文件必须存在于包中并为这些资产生成。您可以尝试使用makepri将.PRI文件转储为XML格式并查看其内容。

+0

谢谢。但那不是答案*“我应该在清单中使用什么路径......?”* –

-1

我设法将WinSCP安装程序转换为AppX package using Advanced Installer

this link你可以从我注意到的正确图标下载软件包。只需提取软件包的内容并检查清单中的路径。

您也可以使用此软件包安装和测试应用程序,只需首先安装自签名证书,并使用该应用程序签名。(在课程的VM

自定义您的包资源:

enter image description here

enter image description here

我建立了一个包含更多的资源,为不同规模新APPX包。你可以从上面的链接下载它,我更新了源代码。

要得到你需要运行该命令的PRI内容:makepri.exe转储

这里是新包的resources.pri.xml内容:

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

+0

谢谢。诚然,它转换的图标比桌面应用程序转换器更好。但另一方面,图标没有缩放版本。 –

+0

高级安装程序有一组专用视图,允许我们的用户在构建appx之前自定义程序包资源,如上图所示。微小和中等的图标是强制性的,所以我们生成它们,就像MSFT一样(他们也尝试生成其他尺寸)。不过,建议您自行构建自己的图标并使用它们,而不是自动生成的图标,因为转换过程无法与原始ICO来源进行比较。 –

+0

谢谢。虽然这并没有帮助我得到我的问题的答案。我看到高级安装程序生成的清单引用了100%的图标版本。如果我添加更高分辨率的图标,它们将被添加到“Assets”子文件夹中。但是在清单中没有提及它们,而不是在'.pri'文件中(与Desktop App Converter相反)。进一步测试后,高级安装程序停止工作。这是给“访问违规”错误和其他神秘的信息,所以我放弃了。 –

0

如果您需要手动修改资源和重建resources.pri,请参阅本白皮书和示例:

https://docs.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

然而,管理应用程序包的可视化资源的最简单方法是使用Visual Studio 2017中的包清单编辑器。

enter image description here

要将其用于转换的应用程序,请创建一个空的UWP项目并添加转换输出你的appx清单)在这个项目中。现在,您可以使用编辑器来管理视觉资产,构建用于商店提交的包等等。 这里是描述过程中的文件:https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net

感谢, 斯特凡·威克 - Windows 8开发平台

+0

感谢您的回答!我会尽快研究并提供反馈意见。 –