terminal/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj
Dustin L. Howett (MSFT) 120e6157c3
Fix the WAP packaging project (#1900)
* Fix the WAP packaging project

This commits fixes the centennial package by:
* Forcing XBF (XAML binary format) files to be embedded in project
  PRI files.
* Moving package content generation to before PRI generation
* Collecting all of the package's PRI files to merge into resources.pri
* Fixing the hardcoded resource paths to reflect the new reality.

It also includes a magic value that fixes the bug where the project is
autodetected as a Mixed (CLR + Native) project.

Fixes #1816.
2019-07-12 15:21:45 -07:00

324 lines
18 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\wap-common.build.pre.props" />
<PropertyGroup Label="Version">
<!-- These fields are picked up by PackageES -->
<VersionMajor>0</VersionMajor>
<VersionMinor>2</VersionMinor>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<!--
These two properties are very important!
Without them, msbuild will stomp MinVersion and MaxVersionTested in the
Package.appxmanifest and replace them with whatever our values for
TargetPlatformMinVersion and TargetPlatformVersion are.
-->
<AppxOSMinVersionReplaceManifestVersion>false</AppxOSMinVersionReplaceManifestVersion>
<AppxOSMaxVersionTestedReplaceManifestVersion>false</AppxOSMaxVersionTestedReplaceManifestVersion>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>CA5CAD1A-224A-4171-B13A-F16E576FDD12</ProjectGuid>
<EntryPointProjectUniqueName>..\WindowsTerminal\WindowsTerminal.vcxproj</EntryPointProjectUniqueName>
<DebuggerType>NativeOnly</DebuggerType>
</PropertyGroup>
<PropertyGroup Condition="!Exists('CascadiaPackage_TemporaryKey.pfx')">
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxBundle>Never</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="Exists('CascadiaPackage_TemporaryKey.pfx')">
<AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<PackageCertificateKeyFile>CascadiaPackage_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<ItemGroup Condition="Exists('CascadiaPackage_TemporaryKey.pfx')">
<None Include="CascadiaPackage_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" Condition="'$(WindowsTerminalReleaseBuild)'=='true'">
<SubType>Designer</SubType>
</AppxManifest>
<AppxManifest Include="Package-Dev.appxmanifest" Condition="'$(WindowsTerminalReleaseBuild)'!='true'">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="$(OpenConsoleDir)res\terminal\LargeTile.scale-100.png">
<Link>Images\LargeTile.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LargeTile.scale-125.png">
<Link>Images\LargeTile.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LargeTile.scale-150.png">
<Link>Images\LargeTile.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LargeTile.scale-200.png">
<Link>Images\LargeTile.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LargeTile.scale-400.png">
<Link>Images\LargeTile.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LockScreenLogo.scale-100.png">
<Link>Images\LockScreenLogo.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LockScreenLogo.scale-125.png">
<Link>Images\LockScreenLogo.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LockScreenLogo.scale-150.png">
<Link>Images\LockScreenLogo.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LockScreenLogo.scale-200.png">
<Link>Images\LockScreenLogo.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\LockScreenLogo.scale-400.png">
<Link>Images\LockScreenLogo.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SmallTile.scale-100.png">
<Link>Images\SmallTile.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SmallTile.scale-125.png">
<Link>Images\SmallTile.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SmallTile.scale-150.png">
<Link>Images\SmallTile.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SmallTile.scale-200.png">
<Link>Images\SmallTile.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SmallTile.scale-400.png">
<Link>Images\SmallTile.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SplashScreen.scale-100.png">
<Link>Images\SplashScreen.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SplashScreen.scale-125.png">
<Link>Images\SplashScreen.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SplashScreen.scale-150.png">
<Link>Images\SplashScreen.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SplashScreen.scale-200.png">
<Link>Images\SplashScreen.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\SplashScreen.scale-400.png">
<Link>Images\SplashScreen.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square150x150Logo.scale-100.png">
<Link>Images\Square150x150Logo.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square150x150Logo.scale-125.png">
<Link>Images\Square150x150Logo.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square150x150Logo.scale-150.png">
<Link>Images\Square150x150Logo.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square150x150Logo.scale-200.png">
<Link>Images\Square150x150Logo.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square150x150Logo.scale-400.png">
<Link>Images\Square150x150Logo.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.scale-100.png">
<Link>Images\Square44x44Logo.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.scale-125.png">
<Link>Images\Square44x44Logo.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.scale-150.png">
<Link>Images\Square44x44Logo.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.scale-200.png">
<Link>Images\Square44x44Logo.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.scale-400.png">
<Link>Images\Square44x44Logo.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-16.png">
<Link>Images\Square44x44Logo.targetsize-16.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-16_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-16_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-20.png">
<Link>Images\Square44x44Logo.targetsize-20.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-20_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-20_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-24.png">
<Link>Images\Square44x44Logo.targetsize-24.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-24_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-24_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-256.png">
<Link>Images\Square44x44Logo.targetsize-256.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-256_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-256_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-30.png">
<Link>Images\Square44x44Logo.targetsize-30.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-30_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-30_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-32.png">
<Link>Images\Square44x44Logo.targetsize-32.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-32_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-32_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-36.png">
<Link>Images\Square44x44Logo.targetsize-36.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-36_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-36_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-40.png">
<Link>Images\Square44x44Logo.targetsize-40.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-40_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-40_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-48.png">
<Link>Images\Square44x44Logo.targetsize-48.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-48_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-48_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-60.png">
<Link>Images\Square44x44Logo.targetsize-60.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-60_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-60_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-64.png">
<Link>Images\Square44x44Logo.targetsize-64.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-64_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-64_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-72.png">
<Link>Images\Square44x44Logo.targetsize-72.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-72_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-72_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-80.png">
<Link>Images\Square44x44Logo.targetsize-80.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-80_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-80_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-96.png">
<Link>Images\Square44x44Logo.targetsize-96.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Square44x44Logo.targetsize-96_altform-unplated.png">
<Link>Images\Square44x44Logo.targetsize-96_altform-unplated.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\StoreLogo.scale-100.png">
<Link>Images\StoreLogo.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\StoreLogo.scale-125.png">
<Link>Images\StoreLogo.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\StoreLogo.scale-150.png">
<Link>Images\StoreLogo.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\StoreLogo.scale-200.png">
<Link>Images\StoreLogo.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\StoreLogo.scale-400.png">
<Link>Images\StoreLogo.scale-400.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-100.png">
<Link>Images\Wide310x150Logo.scale-100.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-125.png">
<Link>Images\Wide310x150Logo.scale-125.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-150.png">
<Link>Images\Wide310x150Logo.scale-150.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-200.png">
<Link>Images\Wide310x150Logo.scale-200.png</Link>
</Content>
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-400.png">
<Link>Images\Wide310x150Logo.scale-400.png</Link>
</Content>
<Content Include="ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-100.png" />
<Content Include="ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-200.png" />
<Content Include="ProfileIcons\{574e775e-4f2a-5b96-ac1e-a2962a402336}.scale-100.png" />
<Content Include="ProfileIcons\{574e775e-4f2a-5b96-ac1e-a2962a402336}.scale-200.png" />
<Content Include="ProfileIcons\{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.scale-100.png" />
<Content Include="ProfileIcons\{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.scale-200.png" />
<Content Include="ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-100.png" />
<Content Include="ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-200.png" />
<PRIResource Include="Resources\en-US\Resources.resw" />
</ItemGroup>
<Import Project="$(OpenConsoleDir)src\wap-common.build.post.props" />
<!--
Microsoft.UI.Xaml contains some <Content> resource files that need to be included in our package.
For some reason, they're not rolled up through dependent projects; if they were, their paths would
be wrong.
WAP Packaging projects don't actually support nuget package references, so we added one manually.
This does mean that version changes to Microsoft.UI.Xaml must be manually reflected
here.
-->
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets'))" />
</Target>
<!-- End workaround -->
<ItemGroup>
<ProjectReference Include="..\WindowsTerminal\WindowsTerminal.vcxproj" />
<ProjectReference Include="..\..\host\exe\Host.EXE.vcxproj" />
</ItemGroup>
<!-- Stomp the path to conhost.exe.
This task will copy OpenConsole.exe to the appx as conhost.exe, and place it
adjacent to WindowsTerminal.exe.
-->
<Target Name="OpenConsoleStompSourceProjectForWapProject" BeforeTargets="_ConvertItems">
<ItemGroup>
<!-- Stomp all "SourceProject" values for all incoming dependencies to flatten the package. -->
<_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" />
<_FilteredNonWapProjProjectOutput Remove="@(_TemporaryFilteredWapProjOutput)" />
<_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)">
<!-- Override the filename for OpenConsole.exe (only) -->
<TargetPath Condition="'%(Filename)' == 'OpenConsole' and '%(Extension)' == '.exe'">conhost.exe</TargetPath>
<!-- Blank the SourceProject here to vend all files into the root of the package. -->
<SourceProject></SourceProject>
</_FilteredNonWapProjProjectOutput>
</ItemGroup>
</Target>
<!-- Move all the PRI files that would be packaged into the appx into _PriFile so that
GenerateProjectPriFile catches them. This requires us to move payload collection
up before GenerateProjectPriFile, when it is typically _after_ it (because the
DesktopBridge project type is built to only prepare the payload during appx manifest
generation.
Since PRI file generation is _before_ manifest generation (for possibly obvious or
important reasons), that doesn't work for us.
-->
<PropertyGroup>
<_GenerateProjectPriFileDependsOn>OpenConsoleLiftDesktopBridgePriFiles;$(_GenerateProjectPriFileDependsOn)</_GenerateProjectPriFileDependsOn>
</PropertyGroup>
<Target Name="OpenConsoleLiftDesktopBridgePriFiles" DependsOnTargets="_ConvertItems">
<ItemGroup>
<_PriFile Include="@(_NonWapProjProjectOutput)" Condition="'%(Extension)' == '.pri'" />
<!-- Remove all other .pri files from the appx payload. -->
<AppxPackagePayload Remove="@(AppxPackagePayload)" Condition="'%(Extension)' == '.pri'" />
</ItemGroup>
</Target>
</Project>