I am trying to package a wpf application into an WPF. I use the makeappx
executable that is packaged with Windows 10. The WPF in question is just a dummy project. All it has is a button (prototype for something else). The WPF itself works as intended when packaged.
Appxmanifest.xml file content:
<?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:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity Name="WpfApp1" Publisher="CN=Something, O=Another thing, L=City, C=DK" Version="1.0.0.0" ProcessorArchitecture="x86" />
<Properties>
<DisplayName>WpfApp1</DisplayName>
<PublisherDisplayName>Something</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Resources>
<Resource Language="EN-US" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="MSIXCore.Desktop" MinVersion="6.1.7601.0" MaxVersionTested="10.0.20348.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.20348.0" />
</Dependencies>
<Applications>
<Application Id="WpfApp1" Executable="WpfApp1.exe" EntryPoint="windows.fullTrustApplication">
<Extensions>
<uap5:Extension Category="windows.appExecutionAlias">
<uap5:AppExecutionAlias>
<uap5:ExecutionAlias Alias="WpfApp1.exe"/>
</uap5:AppExecutionAlias>
</uap5:Extension>
</Extensions>
<uap:VisualElements
BackgroundColor="#464646"
DisplayName="WpfApp1"
Square150x150Logo="Images\StoreLogo.png"
Square44x44Logo="Images\Square44x44Logo.targetsize-24_altform-unplated.png"
Description="A useful description" />
</Application>
</Applications>
</Package>
I have a build pipeline task that packages the application as such:
- task: PowerShell@2
displayName: 'MSIX Packaging'
inputs:
targetType: 'inline'
script: |
& 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe' pack /d 'path\to\output\' /p test.msix
It gets signed and published to artifacts. I can install it without problem. If I launch it like a normal app it works as intended, i.e. the WPF launches and everything's good. However, if I launch it through either URI activation (WpfApp1:
) or, as shown in the example given, execution alias (WpfApp1.exe
), it also opens a blank UI window as shown in the image below alongside the WPF application (i.e. two separate windows):
Anyone able to explain why this blank window appears when launching the app through execution alias and how to prevent the blank window from appearing?
Okay, so I finally found the answer to this. Apparently the problem is this line:
<Application Id="WpfApp1" Executable="WpfApp1.exe" EntryPoint="windows.fullTrustApplication">
Apparently Windows.FullTrustApplication
is supposed to be written in pascal case instead of camel case, even though Microsoft's own documentation consistently uses camel case. I suspect this is a bug in the framework.
So, in short, the Application
element containing the EntryPoint
attribute is supposed to look like this:
<Application Id="WpfApp1" Executable="WpfApp1.exe" EntryPoint="Windows.FullTrustApplication">
Hope this helps someone down the line because this took me days to discover because this creates no errors or warnings when building.