<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(SolutionDir)\ExperimentalFeatures.props" Condition="Exists('$(SolutionDir)\ExperimentalFeatures.props')" />
  <PropertyGroup>
    <ProjectGuid>{b44cead7-fbff-4a17-95eb-ff5434bbd79d}</ProjectGuid>
    <TargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)'!=''">$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
    <DefaultLanguage>en-US</DefaultLanguage>
    <EntryPointProjectUniqueName>ReactApp.vcxproj</EntryPointProjectUniqueName>
    <DebuggerType>NativeOnly</DebuggerType>
    <BackgroundTaskDebugEngines>NativeOnly</BackgroundTaskDebugEngines>
  </PropertyGroup>
  <PropertyGroup Label="ReactNativeWindowsProps">
    <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)'==''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
  </PropertyGroup>
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.WindowsSdk.Default.props" />
  <PropertyGroup>
    <!--
      `AppxManifest.xml` is output relative to the `.wapproj` file and
      `run-windows` cannot find it because it expects `.wapproj` to be in the
      same directory as the solution. We need to change the output directory so
      that `run-windows` can find the file.

      Note that we don't use `OutDir` because the project name is always
      appended to it, e.g. `x64/Debug/ReactApp.Package`.
    -->
    <BaseOutputPath>$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory), $(SolutionDir)))\$(MSBuildProjectName)\bin\</BaseOutputPath>
    <OutputPath>$(BaseOutputPath)\$(Platform)\$(Configuration)\</OutputPath>
    <WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
  </PropertyGroup>
  <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
  <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>
  <ImportGroup Label="ReactNativeWindowsPropertySheets">
    <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.props')" />
  </ImportGroup>
  <ItemGroup>
    <AppxManifest Include="Package.appxmanifest">
      <SubType>Designer</SubType>
    </AppxManifest>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Images\SplashScreen.scale-200.png" />
    <Content Include="Images\Square150x150Logo.scale-100.png" />
    <Content Include="Images\Square150x150Logo.scale-200.png" />
    <Content Include="Images\Square150x150Logo.scale-400.png" />
    <Content Include="Images\Square44x44Logo.altform-lightunplated_targetsize-16.png" />
    <Content Include="Images\Square44x44Logo.altform-lightunplated_targetsize-256.png" />
    <Content Include="Images\Square44x44Logo.altform-lightunplated_targetsize-48.png" />
    <Content Include="Images\Square44x44Logo.altform-unplated_targetsize-16.png" />
    <Content Include="Images\Square44x44Logo.altform-unplated_targetsize-256.png" />
    <Content Include="Images\Square44x44Logo.altform-unplated_targetsize-48.png" />
    <Content Include="Images\Square44x44Logo.scale-100.png" />
    <Content Include="Images\Square44x44Logo.scale-200.png" />
    <Content Include="Images\Square44x44Logo.scale-400.png" />
    <Content Include="Images\Square44x44Logo.targetsize-16.png" />
    <Content Include="Images\Square44x44Logo.targetsize-256.png" />
    <Content Include="Images\Square44x44Logo.targetsize-48.png" />
    <Content Include="Images\StoreLogo.scale-100.png" />
    <Content Include="Images\StoreLogo.scale-200.png" />
    <Content Include="Images\StoreLogo.scale-400.png" />
    <Content Include="Images\Wide310x150Logo.scale-200.png" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="ReactApp.vcxproj">
      <SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
  <ImportGroup Label="ReactNativeWindowsTargets">
    <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.targets')" />
  </ImportGroup>
  <Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references targets in your node_modules\react-native-windows folder that are missing. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.props'))" />
    <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.Package.targets'))" />
  </Target>
  <Target Name="CopyAppPackagesToOutputDirectory" AfterTargets="_GenerateAppxPackage">
    <!--
      `AppPackages` is output relative to the `.wapproj` file and `run-windows`
      cannot find it because it expects `.wapproj` to be in the same directory
      as the solution. We need to copy the files to the output directory so that
      `run-windows` can find them.
    -->
    <ItemGroup>
      <AppPackagesFiles Include="$(MSBuildThisFileDirectory)\AppPackages\**\*.*"/>
    </ItemGroup>
    <Copy
      SourceFiles="@(AppPackagesFiles)"
      DestinationFolder="$(BaseOutputPath)\..\AppPackages\%(RecursiveDir)"
      UseSymbolicLinksIfPossible="true"
    />
  </Target>
</Project>
