0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

素の実行ファイル(exe)をMicrosoftStoreに登録するまでの記録(整理版)

Posted at

こちら(https://qiita.com/tanakah/items/068e232b9dbba67d09b7) の手順で、一応はmsix形式のインストーラを作成することができましたが、その後内容を整理したので、その簡略化した手順を覚書としておいておきます。
※ 詳細な手順、内容はMicrosoftの公式文書をあたってください
※ Windows10で、Windows10/11用のデスクトップアプリのmsixを作成したときの作業に基づきます。

1. 構成ファイルのツリーを作成する

XXXX -> 構成ファイルのルートフォルダー
YYYY.exe -> インストールする実行ファイル

とするとき、XXXX 以下が、一意な名前を頭につけてProgram Files\WindowsAppsにコピーされるので、たとえば

XXXX\VFS\ProgramFilesX64\YYYY\YYYY.exe

とした構成ファイルのツリーを作成しておきます。(Program Files\YYYY\YYYY.exeのリダイレクト先がProgram Files\WindowsApps\一意な名前\VFS\ProgramFilesX64\YYYY\YYYY.exeとなる)

そして次にアイコンファイルをVFS\Assetsフォルダー内に収めます。
最低限必要なファイルは、

XXXX\Assets\StoreLogo.png
XXXX\Assets\Square44x44Logo.png
XXXX\Assets\Square44x44Logo.targetsize-16.png
XXXX\Assets\Square44x44Logo.targetsize-16_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-16_altform-unplated.png
XXXX\Assets\Square44x44Logo.targetsize-24.png
XXXX\Assets\Square44x44Logo.targetsize-24_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-24_altform-unplated.png
XXXX\Assets\Square44x44Logo.targetsize-32.png
XXXX\Assets\Square44x44Logo.targetsize-32_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-32_altform-unplated.png
XXXX\Assets\Square44x44Logo.targetsize-48.png
XXXX\Assets\Square44x44Logo.targetsize-48_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-48_altform-unplated.png
XXXX\Assets\Square44x44Logo.targetsize-64.png
XXXX\Assets\Square44x44Logo.targetsize-64_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-64_altform-unplated.png
XXXX\Assets\Square44x44Logo.targetsize-256.png
XXXX\Assets\Square44x44Logo.targetsize-256_altform-lightunplated.png
XXXX\Assets\Square44x44Logo.targetsize-256_altform-unplated.png
XXXX\Assets\Square150x150Logo.png

unplatedのアイコンファイル(ライトモード用,ダークモード用)が必要になります。

2. AppXManifest.xmlの作成

既存のファイルのコピペから、こんな感じに作成しておきます。
Identity Versionには、インストーラのバージョンを記述します。
Publisherの名前をZZZZとしています。
また、1.で作成したアイコンファイルをVisualElementsに記述して指定します。

<?xml version="1.0" encoding="utf-8"?>
<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  xmlns:uap18="http://schemas.microsoft.com/appx/manifest/uap/windows10/18"
  IgnorableNamespaces="uap rescap uap18" >

  <Identity Name="ZZZZ.YYYY" Publisher="CN=ZZZZ" Version="1.0.0.0" ProcessorArchitecture="x64" />

  <Properties>
    <DisplayName>YYYY</DisplayName>
    <PublisherDisplayName>ZZZZ/PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>

  <Resources>
    <Resource Language="en-US" />
  </Resources>

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
  </Dependencies>

  <Applications>
    <Application Id="ZZZZ.YYYY" Executable="VFS\ProgramFilesX64\YYYY\YYYY.exe" 
                 EntryPoint="Windows.FullTrustApplication" uap18:RuntimeBehavior="win32App">

      <uap:VisualElements
        DisplayName="YYYY"
        Description="YYYY"
        Square150x150Logo="Assets\Square150x150Logo.png"
        Square44x44Logo="Assets\Square44x44Logo.png"
        BackgroundColor="transparent" >
      
        <uap:DefaultTile>
          <uap:ShowNameOnTiles>
            <uap:ShowOn Tile="square150x150Logo"/>
          </uap:ShowNameOnTiles>
        </uap:DefaultTile>

      </uap:VisualElements>

    </Application>
  </Applications>
  
  <Capabilities>
    <rescap:Capability Name="runFullTrust" />
  </Capabilities>

</Package>

3. パッケージリソースインデックスファイルを作成する

最初にデフォルトのコンフィグファイルを

MakePri.exe createconfig /cf XXXX\PriConfig.xml /dq en-US

で作成します。2.のAppXManifest.xml内でResource Language="en-US"としたので、en-USを指定。
すると、XXXX\PriConfig.xmlが作成されます。必要に応じて修正してもよいのですが、とりあえずこのままでOK。

つづいて

MakePri.exe new /pr XXXX /cf XXXX\PriConfig.xml /mn XXXX\AppXManifest.xml /of XXXX\resources.pri /o

を実行することで、パッケージリソースインデックスファイルであるresources.priが作成されます。
実行結果例の抜粋は以下。

Resource File: resources.pri
Version: 1.0
Resource Candidates: 28
AlternateForm Qualifiers: LIGHTUNPLATED,UNPLATED
TargetSize Qualifiers: 256,16,24,32,48,64

4. msixファイルの生成

こっから先は、こちら(https://qiita.com/tanakah/items/068e232b9dbba67d09b7) で紹介したMSIX Heroを使用していけばよいでしょう。(コマンドラインで各種ツールを実行して作業してもいいんだろうけど面倒だよね)
自己署名の証明書を作成、登録しておいて、msixファイルに添付してやれば完成。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?