<Project>
<!-- Windows App SDK 2.5.1 omits this version resource in self-contained
output, which makes AppNotificationManager.Register fail (SDK #6774).
Reuse the matching, signed resource from the restored official MSIX;
do not install a runtime or copy anything into the user's OS. -->
<Target Name="IncludeArrivalNotificationRuntimeResource" BeforeTargets="AssignTargetPaths"
Condition="'$(WindowsAppSDKSelfContained)' == 'true' and '$(DesignTimeBuild)' != 'true'">
<PropertyGroup>
<_ArrivalRuntimePackageName>$(WinAppSDKPackageName)</_ArrivalRuntimePackageName>
<_ArrivalRuntimePackageName Condition="'$(_ArrivalRuntimePackageName)' == ''">Microsoft.WindowsAppRuntime.2</_ArrivalRuntimePackageName>
<_ArrivalRuntimeArchive>$(PkgMicrosoft_WindowsAppSDK_Runtime)/tools/MSIX/win10-$(PlatformTarget)/$(_ArrivalRuntimePackageName).msix</_ArrivalRuntimeArchive>
<_ArrivalRuntimeDirectory>$(IntermediateOutputPath)ArrivalNotifications/</_ArrivalRuntimeDirectory>
<_ArrivalRuntimeResource>Microsoft.WindowsAppRuntime.Insights.Resource.dll</_ArrivalRuntimeResource>
</PropertyGroup>
<Unzip SourceFiles="$(_ArrivalRuntimeArchive)" DestinationFolder="$(_ArrivalRuntimeDirectory)"
Include="$(_ArrivalRuntimeResource)" SkipUnchangedFiles="true" />
<Error Condition="!Exists('$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)')"
Text="The Windows notification resource was not found in the restored Windows App SDK runtime." />
<ItemGroup>
<Content Include="$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)">
<Link>$(_ArrivalRuntimeResource)</Link>
<TargetPath>$(_ArrivalRuntimeResource)</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<FileWrites Include="$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)" />
</ItemGroup>
</Target>
</Project>
<Project>
<!-- Windows App SDK 2.5.1 omits this version resource in self-contained
output, which makes AppNotificationManager.Register fail (SDK #6774).
Reuse the matching, signed resource from the restored official MSIX;
do not install a runtime or copy anything into the user's OS. -->
<Target Name="IncludeArrivalNotificationRuntimeResource" BeforeTargets="AssignTargetPaths"
Condition="'$(WindowsAppSDKSelfContained)' == 'true' and '$(DesignTimeBuild)' != 'true'">
<PropertyGroup>
<_ArrivalRuntimePackageName>$(WinAppSDKPackageName)</_ArrivalRuntimePackageName>
<_ArrivalRuntimePackageName Condition="'$(_ArrivalRuntimePackageName)' == ''">Microsoft.WindowsAppRuntime.2</_ArrivalRuntimePackageName>
<_ArrivalRuntimeArchive>$(PkgMicrosoft_WindowsAppSDK_Runtime)/tools/MSIX/win10-$(PlatformTarget)/$(_ArrivalRuntimePackageName).msix</_ArrivalRuntimeArchive>
<_ArrivalRuntimeDirectory>$(IntermediateOutputPath)ArrivalNotifications/</_ArrivalRuntimeDirectory>
<_ArrivalRuntimeResource>Microsoft.WindowsAppRuntime.Insights.Resource.dll</_ArrivalRuntimeResource>
</PropertyGroup>
<Unzip SourceFiles="$(_ArrivalRuntimeArchive)" DestinationFolder="$(_ArrivalRuntimeDirectory)"
Include="$(_ArrivalRuntimeResource)" SkipUnchangedFiles="true" />
<Error Condition="!Exists('$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)')"
Text="The Windows notification resource was not found in the restored Windows App SDK runtime." />
<ItemGroup>
<Content Include="$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)">
<Link>$(_ArrivalRuntimeResource)</Link>
<TargetPath>$(_ArrivalRuntimeResource)</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<FileWrites Include="$(_ArrivalRuntimeDirectory)$(_ArrivalRuntimeResource)" />
</ItemGroup>
</Target>
</Project>