Our app is built in WPF but we are adding notifications with UWP. We have a packaging project, a UWP background task project, and an empty UWP app project that references the background task project, in addition to many other unrelated projects in the solution. The packaging project references the main WPF project and the empty UWP project. Building works fine in Visual Studio but fails when building with msbuild from the command line or our build system. We get this error:
"C:\repos\appName\BuildAll\appName.sln" (default target) (1) ->
"C:\repos\appName\BuildAll\..\appName.DesktopBridge\appName.DesktopBridge.wapproj.metaproj" (default target) (18) ->
"C:\repos\appName\appName.DesktopBridge\appName.DesktopBridge.wapproj" (default target) (19) ->
(_ValidateAppxManifest target) ->
C:\repos\appName\appName.DesktopBridge\bin\x86\Debug\AppxManifest.xml : error APPX0501: Validation error. error 800
80204: App manifest validation error: Line 64, Column 27, Reason: The field "*[local-name()='Extensions']/*[local-name(
)='Extension']/*[local-name()='InProcessServer']/*[local-name()='ActivatableClass']" with value "Microsoft.UI.Xaml.Mark
up.ReflectionXamlMetadataProvider" must only be declared once. A duplicate exists on Line 57, Column 27. [C:\repos\appName\appName.DesktopBridge\appName.DesktopBridge.wapproj]
This is because when using msbuild the extensions sections of AppxManifest.xml looks like this:
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>appName.exe</Path>
<ActivatableClass ActivatableClassId="Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="appName.BackgroundTasks.IncomingCallPushTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>CLRHost.dll</Path>
<ActivatableClass ActivatableClassId="Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="appName.BackgroundTasks.IncomingCallPushTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
When building with Visual studio it looks like this and works fine:
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="appName.BackgroundTasks.IncomingCallPushTask" Executable="appName.exe">
<BackgroundTasks>
<Task Type="pushNotification" />
</BackgroundTasks>
</Extension>
</Extensions>
I have tried specifying the extensions in Package.appxmanifest to look like what needs to appear in AppxManifest.xml but have not been able to get msbuild to generate a valid AppxManifest file.