Repository: microsoft/terminal (language: cpp)

Issue:
Visual Studio fails to restore NuGet because src\cascadia\TerminalApp\packages.config has two copies of Microsoft.UI.Xaml
### Windows Terminal version

commit f17c2babd4f22c21b9ad0897f884b2b3dbe173f1

### Windows build number

_No response_

### Other Software

Visual Studio 2022 (17.1.1)

### Steps to reproduce

Fresh clone of Terminal repo
Restore git submodules
Open OpenConsole.sln
Try to build x64|Debug

### Expected Behavior

It builds

### Actual Behavior

NuGet restore fails and 11 projects fail with it.  Clicking "Manage NuGet for Solution" has this error:
![image](https://user-images.githubusercontent.com/46852402/157956157-3388fa15-2e84-410d-b94b-85206ff7cdc1.png)

Clicking "Show errors in output" has this output:
`An error occurred while reading file 'v:\T\terminal\src\cascadia\TerminalApp\packages.config': There are duplicate packages: Microsoft.UI.Xaml`

Sure enough packages.config has two copies of XAML:
`<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.1.3" targetFramework="native" />
  <package id="Microsoft.UI.Xaml" version="2.7.0" targetFramework="native" />
  <package id="Microsoft.UI.Xaml" version="2.7.0-prerelease.210913003" targetFramework="native" />
  <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
</packages>`

Looking at "git blame" this was introduced as part of https://github.com/microsoft/terminal/commit/53a454fbd3e2992be5c1f2c8ed9e2c2974f0e7b8 on 2/25/2022.


Discussion / hints:

Fix patch:
diff --git a/build/packages.config b/build/packages.config
index 7b2f271d521..189017052d2 100644
--- a/build/packages.config
+++ b/build/packages.config
@@ -3,4 +3,6 @@
   <package id="MUXCustomBuildTasks" version="1.0.48" targetFramework="native" />
   <package id="Microsoft.Taef" version="10.60.210621002" targetFramework="native" />
   <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
+  <!-- This cannot be included in another project that depends on XAML (as it would be a duplicate package ID) -->
+  <package id="Microsoft.UI.Xaml" version="2.7.0" targetFramework="native" />
 </packages>
diff --git a/common.openconsole.props b/common.openconsole.props
index 400555dbdd5..8df0c31d091 100644
--- a/common.openconsole.props
+++ b/common.openconsole.props
@@ -15,11 +15,15 @@
     For the Windows 10 build, we're targeting the prerelease version of Microsoft.UI.Xaml.
     This version emits every XAML DLL directly into our package.
     This is a workaround for us not having deliverable MSFT-21242953 on this version of Windows.
+
+    This version should be tracked in all project packages.config files for projects that depend on Xaml.
     -->
     <TerminalMUXVersion>2.7.0-prerelease.210913003</TerminalMUXVersion>
     <!--
     For the Windows 11-specific build, we're targeting the public version of Microsoft.UI.Xaml.
     This version emits a package dependency instead of embedding the dependency in our own package.
+
+    This version should be tracked in build/packages.config.
     -->
     <TerminalMUXVersion Condition="'$(TerminalTargetWindowsVersion)'=='Win11'">2.7.0</TerminalMUXVersion>
   </PropertyGroup>
diff --git a/src/cascadia/TerminalApp/packages.config b/src/cascadia/TerminalApp/packages.config
index 62c921a4fac..e039fa4ae47 100644
--- a/src/cascadia/TerminalApp/packages.config
+++ b/src/cascadia/TerminalApp/packages.config
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.1.3" targetFramework="native" />
-  <package id="Microsoft.UI.Xaml" version="2.7.0" targetFramework="native" />
   <package id="Microsoft.UI.Xaml" version="2.7.0-prerelease.210913003" targetFramework="native" />
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
   <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />


Test patch: