2017-02-10 51 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

感謝您的回答!我會盡快研究並提供反饋意見。 –