Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new reunion sample app #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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"
IgnorableNamespaces="uap rescap">

<Identity
Name="7f4adcd6-e37a-4d8a-81af-5f17f37f86e2"
Publisher="CN=jasteph"
Version="1.0.0.0" />

<Properties>
<DisplayName>ProjectReunion_DemoApp (Package)</DisplayName>
<PublisherDisplayName>jasteph</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>

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

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="ProjectReunion_DemoApp (Package)"
Description="ProjectReunion_DemoApp (Package)"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|arm64">
<Configuration>Debug</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|arm64">
<Configuration>Release</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>ProjectReunion_DemoApp\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>7efcce03-487f-44bd-9bd5-ca60be463f15</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxTargetsLocation Condition="'$(AppxTargetsLocation)'==''">$(MSBuildThisFileDirectory)build\</AppxTargetsLocation>
<EntryPointProjectUniqueName>..\ProjectReunion_DemoApp\ProjectReunion_DemoApp.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ProjectReunion_DemoApp\ProjectReunion_DemoApp.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<Import Project="$(AppxTargetsLocation)Microsoft.WinUI.AppX.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
<!--
Copyright (c) Microsoft Corporation. Licensed under the MIT License
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
The _GetPathToWinUIRegistrations target returns the path to where the registrations xml file is.
If invoked in the .wapproj, this will invoke the same target on referenced projects, where it will
actually return the location to where the file is on disk in the nuget package.
-->
<Target Name="_GetPathToWinUIRegistrations" Returns="$(WinUIClassRegistrationsDir)">
<!--
Invoke this target on the referenced project to get the path to where the registration xml is.
This way we can pick up the path to the file from the nuget.
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Condition="'$(MSBuildProjectExtension)' == '.wapproj'"
Targets="_GetPathToWinUIRegistrations"
SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" PropertyName="WinUIClassRegistrationsDir" />
</MSBuild>

<PropertyGroup>
<!-- If not in the .wapproj, then actually return the path to where the registration list is -->
<WinUIClassRegistrationsDir Condition="'$(WinUIClassRegistrationsDir)' == '' and '$(MSBuildProjectExtension)'!='.wapproj'">$(MSBuildThisFileDirectory)</WinUIClassRegistrationsDir>

<!-- Technically you can have multiple .exe files in a single msix. Just trim the property down to a single value if that is the case -->
<WinUIClassRegistrationsDir Condition="$(WinUIClassRegistrationsDir.Contains(';'))">$(WinUIClassRegistrationsDir.Substring(0,$(WinUIClassRegistrationsDir.IndexOf(';'))))</WinUIClassRegistrationsDir>
</PropertyGroup>

<Error Text="Unable to find WinRT class registrations for WinUI. Please ensure that the Microsoft.WinUI package restored successfully."
Condition="'$(WinUIClassRegistrationsDir)' == '' and '$(MSBuildProjectExtension)'=='.wapproj'"/>
</Target>

<!-- Replaces AppxManifest WinRT registrations for Microsoft.UI.Xaml.dll, post-GenerateAppxManifest. -->
<!-- Target runs before manifest validation occurs. Requires output file to support incremental builds. -->
<Target
Name="_ReplaceMUXWinRTRegistrations"
BeforeTargets="_CreateFinalAppxManifestItem"
AfterTargets="_GenerateCurrentProjectAppxManifest"
DependsOnTargets="_GetPathToWinUIRegistrations"
Inputs="$(MSBuildAllProjects);@(_GenerateCurrentProjectAppxManifestInput)"
Outputs="$(FinalAppxManifestName).incremental" >

<ReplaceMUXWinRTRegistrations
FullPathToAppxManifest="$(FinalAppxManifestName)"
FullPathToLiftedXAMLWinRTRegistrations="$(WinUIClassRegistrationsDir)LiftedWinRTClassRegistrations.xml"
PathToXAMLWinRTImplementations="$(PathToXAMLWinRTImplementations)"
/>

<Touch
Files="$(FinalAppxManifestName).incremental"
AlwaysCreate="true"
/>
</Target>

<UsingTask TaskName="ReplaceMUXWinRTRegistrations" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<FullPathToAppxManifest ParameterType="System.String" Required="true" />
<FullPathToLiftedXAMLWinRTRegistrations ParameterType="System.String" Required="true" />
<PathToXAMLWinRTImplementations ParameterType="System.String" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Using Namespace="System.Xml" />
<Using Namespace="System.Reflection" />
<Using Namespace="System.Runtime.InteropServices.WindowsRuntime" />
<Using Namespace="System.Collections.Generic" />
<Code Type="Fragment" Language="cs"><![CDATA[
// Load AppxManifest.xml
XmlDocument appxManifest = new XmlDocument();
appxManifest.Load(FullPathToAppxManifest);

XmlNamespaceManager namespaceManager = new XmlNamespaceManager(appxManifest.NameTable);
namespaceManager.AddNamespace("w", "http://schemas.microsoft.com/appx/manifest/foundation/windows10");

// If there exists an existing Extensions node, we'll remove any Microsoft.UI.Xaml.dll, Microsoft.Web.WebView2.Core.dll entry in it
// and add the correct DLL mapping. Otherwise, if there doesn't, we'll create one and add it.
XmlNode extensionsNode = null;

foreach (XmlNode node in appxManifest.DocumentElement.SelectNodes("//w:Package/w:Extensions", namespaceManager))
{
extensionsNode = node;
break;
}

if (extensionsNode != null)
{
XmlNodeList xmlNodeList = appxManifest.DocumentElement.SelectNodes("//w:Package/w:Extensions/w:Extension", namespaceManager);

// Remove "Microsoft.UI.Xaml.dll", "Microsoft.Web.WebView2.Core.dll", and
// "Microsoft.ApplicationModel.Resources.dll" registrations from the
// AppxManifest file as we will be inserting the entries ourselves
foreach (XmlNode node in xmlNodeList)
{
XmlNode pathNode = node.SelectSingleNode("w:InProcessServer/w:Path", namespaceManager);
if (pathNode.InnerText.Equals("Microsoft.UI.Xaml.dll", StringComparison.InvariantCultureIgnoreCase) ||
pathNode.InnerText.Equals("Microsoft.Web.WebView2.Core.dll", StringComparison.InvariantCultureIgnoreCase) ||
pathNode.InnerText.Equals("Microsoft.ApplicationModel.Resources.dll", StringComparison.InvariantCultureIgnoreCase))
{
extensionsNode.RemoveChild(node);
}
}
}
else
{
extensionsNode = appxManifest.CreateElement("Extensions", "http://schemas.microsoft.com/appx/manifest/foundation/windows10");
appxManifest.DocumentElement.AppendChild(extensionsNode);
}

// Load correct WinRT registration file created during build. These entries have the correct implemetation DLLs.
XmlDocument newRegistrations = new XmlDocument();
newRegistrations.Load(FullPathToLiftedXAMLWinRTRegistrations);
XmlNamespaceManager namespaceManager2 = new XmlNamespaceManager(newRegistrations.NameTable);
namespaceManager2.AddNamespace("w", "http://schemas.microsoft.com/appx/manifest/foundation/windows10");
XmlNodeList newRegistrationNodes = newRegistrations.DocumentElement.SelectNodes("/w:Data/w:Extension", namespaceManager2);

// Add entries for all Microsoft.UI.Xaml types in the AppxManifest
foreach (XmlNode node in newRegistrationNodes)
{
// If we have a path to our implementation DLLs, we'll add that here.
if (!string.IsNullOrWhiteSpace(PathToXAMLWinRTImplementations))
{
XmlNode pathNode = node.SelectSingleNode("w:InProcessServer/w:Path", namespaceManager);
pathNode.InnerText = PathToXAMLWinRTImplementations + pathNode.InnerText;
}
XmlNode importNode = extensionsNode.OwnerDocument.ImportNode(node, true);
extensionsNode.AppendChild(importNode);
}

// Save the updated AppxManifest.xml file
appxManifest.Save(FullPathToAppxManifest);

]]></Code>
</Task>
</UsingTask>

<PropertyGroup>
<MSBuildWarningsAsMessages>
$(MSBuildWarningsAsMessages);

<!-- We don't provide an implementation for Microsoft.winmd, but that's OK, since we're constructing
our own Extensions entries in AppxManifest.xml. As such, we'll suppress the warning that that would otherwise raise. -->
APPX1707;
</MSBuildWarningsAsMessages>
<MSBuildWarningsAsMessages Condition="'$(MSBuildProjectExtension)' == '.wapproj'">
$(MSBuildWarningsAsMessages);

<!-- WAP project files can have class libraries with WinMDs complain that they don't have requisite dependencies present -
however, due to our custom packaging, they'll be present in the end, so we'll suppress this warning as well. -->
MSB3268;
</MSBuildWarningsAsMessages>
</PropertyGroup>

<!-- Packing class libraries in a WAP project can erroneously raise a warning thinking that we've packaged multiple executables.
We'll suppress that warning, since it's being raised in error. -->
<Target Name="_UWPReferencesCheck" Condition="'$(MSBuildProjectExtension)' == '.wapproj'" />

<!--
Setting default project properties for .NET SDK-style projects
-->
<PropertyGroup Condition="'$(UsingMicrosoftNETSdk)' == 'true'">
<SDKIdentifier>Windows</SDKIdentifier>
<SDKVersion>10.0</SDKVersion>
<DefaultLanguage Condition="'$(DefaultLanguage)'==''">en-US</DefaultLanguage>
</PropertyGroup>

<!--
By default, the Nuget targets for .NET Native UWP projects copy MUI files to the root of the AppX.
However, we need them in language-specific locations, so we'll move them there after resolving our
assembly references, which is what places them in ReferenceCopyLocalPaths.

Note: This isn't needed for native projects or projects that are using the Microsoft.NET.Sdk, since
we manually add them to ReferenceCopyLocalPaths. Once we are fully onto .NET5, we can remove this target.
-->
<Target Name="_UpdateMuiFilesCopyLocalPath"
BeforeTargets="_CopyFilesMarkedCopyLocal"
AfterTargets="ResolveAssemblyReferences"
Condition="'$(_AddWinUIAssembliesToReferenceCopyLocalPaths)' != 'true'">
<PropertyGroup Condition="'$(_MuxRuntimeIdentifier)' == ''">
<_MuxRuntimeIdentifier Condition="'$(Platform)' == 'Win32'">win10-x86</_MuxRuntimeIdentifier>
<_MuxRuntimeIdentifier Condition="'$(Platform)' != 'Win32'">win10-$(Platform)</_MuxRuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<ReferenceCopyLocalPaths Update="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' == 'Microsoft.WinUI' and '%(Extension)' == '.mui'">
<DestinationSubDirectory>$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory)..\runtimes\$(_MuxRuntimeIdentifier)\native\, %(RootDir)%(Directory)))</DestinationSubDirectory>
</ReferenceCopyLocalPaths>
</ItemGroup>
</Target>

<Target Name="_UpdateWapProjectPackageFiles"
BeforeTargets="_CopyPackageFiles;_CopyUploadPackageFiles"
AfterTargets="_ConvertItems"
Condition="'$(MSBuildProjectExtension)' == '.wapproj'">
<ItemGroup>
<!-- In the case of native projects, the TargetPath gets overwritten to remove the language-specific subfolders
in the _ConvertItems target, so in the case where that's happened, we'll restore it from the
DestinationSubDirectory item metadata. -->
<WapProjPackageFile Update="@(WapProjPackageFile)" Condition="'%(WapProjPackageFile.DestinationSubDirectory)' != '' and '%(TargetPath)' == '%(Filename)%(Extension)'">
<TargetPath>%(WapProjPackageFile.DestinationSubDirectory)%(TargetPath)</TargetPath>
</WapProjPackageFile>
<UploadWapProjPackageFile Update="@(UploadWapProjPackageFile)" Condition="'%(UploadWapProjPackageFile.DestinationSubDirectory)' != '' and '%(TargetPath)' == '%(Filename)%(Extension)'">
<TargetPath>%(UploadWapProjPackageFile.DestinationSubDirectory)%(TargetPath)</TargetPath>
</UploadWapProjPackageFile>
</ItemGroup>
</Target>

<!--
Add a dependency for the app against VCLibs.Desktop, which contains the CRT DLLs that WinUI 3 is linked against. -->
<ItemGroup Condition="'$(OutputType)' == 'Exe' or '$(OutputType)' == 'AppContainerExe' or '$(MSBuildProjectExtension)'=='.wapproj'">
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" />
<!-- Needed for ucrtbased.dll when running a debug build. -->
<SDKReference Include="Microsoft.UniversalCRT.Debug, Version=$(TargetPlatformVersion)" Condition="'$(Configuration)' == 'Debug'" />
<!-- Needed until Microsoft.ApplicationModel.Resources.dll and Microsoft.Web.WebView2.Core.dll
no longer depend on the _app version of CRT DLLs. -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0" />
</ItemGroup>

<!-- In order to have the Microsoft.UniversalCRT.Debug SDK reference included in the AppX, we need to
set IncludeSDKRedistOutputGroup to true. -->
<Target Name="IncludeSDKRedistOutputGroup" BeforeTargets="GetPackagingOutputs" Condition="('$(OutputType)' == 'AppContainerExe' or '$(MSBuildProjectExtension)'=='.wapproj') and '$(Configuration)' == 'Debug'">
<PropertyGroup>
<IncludeSDKRedistOutputGroup>true</IncludeSDKRedistOutputGroup>
</PropertyGroup>
</Target>

<!--
WindowsAppContainer is the property that you can set in your .NET Desktop project to turn it into a UWP.
When the ProjectReferenceWithExtraMetadata.TargetPlatformIdentifier is set to UAP, this causes the AppxManifest.xml
generation targets to write in the app entry point which causes UWP activation.
-->
<Target Name="UpdateTargetPlatformIdentifer" AfterTargets="SetProjectReferenceProperties" Returns="@(ProjectReferenceWithExtraMetadata)">
<ItemGroup>
<ProjectReferenceWithExtraMetadata Update="@(ProjectReferenceWithExtraMetadata)" Condition="'%(WindowsAppContainer)'=='true'">
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
</ProjectReferenceWithExtraMetadata>
</ItemGroup>
</Target>

<!-- NuGet restore is now supported for wapproj files, so we need to supply an AssetTargetFallback value
in order for that not to raise an error. -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.wapproj'">
<AssetTargetFallback>net5.0-windows$(TargetPlatformVersion)</AssetTargetFallback>
</PropertyGroup>

<!-- See https://github.com/microsoft/CsWinRT/issues/373 -->
<Target Name="ValidateNoPublishTrimmed" BeforeTargets="PrepareForBuild" Condition="'$(PublishTrimmed)'=='true'">
<Error Text="Publishing with IL trimming is not yet supported."/>
</Target>

</Project>
Loading