Repository: microsoft/terminal (language: cpp)

Issue:
Repo can't build in a directory with a space
> Reverted all changes to OpenConsole.sln by removing and recloning the project.
> 
> Picked: ![image](https://user-images.githubusercontent.com/15957528/237941072-ca89bc94-5d40-44a2-90ec-b8788920fa89.png)
> 
> Restored and updated submodules `git submodule update --init --recursive`
> 
> Ignored warning about incorrect configurations. In the Debug menu, I changed "Application process" and "Background task process" to "Native Only".
> 
> Build it, had an issue with nuget packages:
> 
> ![Nuget Package Restore 2023-05-12 114632](https://user-images.githubusercontent.com/15957528/237942452-bb571cc4-d0e2-4dc8-af4f-a2bdbaa517f3.png)
> 
> Solved that by building with Powershell. This installed the packages, but this time build ended with errors. Afterwards I deleted the Obj and Bin folder of the project and build it with visual studio, getting the same erros as before, but getting similar errors with PowerShell now as well:
> 
> ![Same Errors ](https://user-images.githubusercontent.com/15957528/237943674-756c0f6f-9c8f-4a97-a0cb-4a8826c9b832.png)
> 
> ![image](https://user-images.githubusercontent.com/15957528/237947321-86c86eb9-a103-4084-8717-b56e4724855f.png)
> 
> ![image](https://user-images.githubusercontent.com/15957528/237948278-181aca8a-fd23-40a9-b211-b2b3726711a4.png)



Btw, the software not being able to be build when someone has a username that contains a space.  This may be a new issue? If so, I could make a new issue for it. 
Can't help but being bugged by not having the project in my preferable location.

_Originally posted by @Jaswir in https://github.com/microsoft/terminal/issues/15127#issuecomment-1547609968_
            


Discussion / hints:
Almost certainly the issue is in: https://github.com/microsoft/terminal/blob/main/build/rules/GenerateSxsManifestsFromWinmds.targets
Taking a look to see if I can be of help.

Fix patch:
diff --git a/build/rules/GenerateSxsManifestsFromWinmds.targets b/build/rules/GenerateSxsManifestsFromWinmds.targets
index 600f9980ce0..6e17cc50dcb 100644
--- a/build/rules/GenerateSxsManifestsFromWinmds.targets
+++ b/build/rules/GenerateSxsManifestsFromWinmds.targets
@@ -30,7 +30,7 @@
           DependsOnTargets="_ConsoleMapWinmdsToManifestFiles">
 
     <!-- This target is batched and a new Exec is spawned for each entry in _ConsoleWinmdManifest. -->
-    <Exec Command="mt.exe -winmd:%(_ConsoleWinmdManifest.WinMDPath) -dll:%(_ConsoleWinmdManifest.Implementation) -out:%(_ConsoleWinmdManifest.Identity)" />
+    <Exec Command="mt.exe -winmd:&quot;%(_ConsoleWinmdManifest.WinMDPath)&quot; -dll:%(_ConsoleWinmdManifest.Implementation) -out:&quot;%(_ConsoleWinmdManifest.Identity)&quot;" />
 
     <ItemGroup>
       <!-- Emit the generated manifest into the Link inputs. -->
diff --git a/src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj b/src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj
index 43f77d6eb1d..2f77b745661 100644
--- a/src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj
+++ b/src/cascadia/TerminalSettingsModel/Microsoft.Terminal.Settings.ModelLib.vcxproj
@@ -327,7 +327,7 @@
 
   <!-- PowerShell version check, outputs error if the wrong version is installed. -->
   <Target Name="_WindowsPowershellVersionCheck" BeforeTargets="BeforeClCompile">
-    <Exec Command="powershell.exe -NoProfile -ExecutionPolicy Unrestricted &quot;$(OpenConsoleDir)\tools\WindowsCheckPSVersion.ps1&quot;" />
+    <Exec Command="powershell.exe -NoProfile -ExecutionPolicy Unrestricted -File &quot;$(OpenConsoleDir)\tools\WindowsCheckPSVersion.ps1&quot;" />
   </Target>
   <Target Name="_PowershellVersionCheck" BeforeTargets="BeforeClCompile">
     <Exec Command="pwsh.exe -NoProfile -ExecutionPolicy Unrestricted &quot;$(OpenConsoleDir)\tools\CheckPSVersion.ps1&quot;" />
diff --git a/src/cascadia/WindowsTerminal_UIATests/WindowsTerminal.UIA.Tests.csproj b/src/cascadia/WindowsTerminal_UIATests/WindowsTerminal.UIA.Tests.csproj
index 6e872176954..589cb6f3af4 100644
--- a/src/cascadia/WindowsTerminal_UIATests/WindowsTerminal.UIA.Tests.csproj
+++ b/src/cascadia/WindowsTerminal_UIATests/WindowsTerminal.UIA.Tests.csproj
@@ -126,7 +126,7 @@
   <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>copy $(SolutionDir)\dep\WinAppDriver\* $(OutDir)\</PostBuildEvent>
+    <PostBuildEvent>copy &quot;$(SolutionDir)\dep\WinAppDriver\*&quot; &quot;$(OutDir)\&quot;</PostBuildEvent>
   </PropertyGroup>
   <Import Project="..\..\common.nugetversions.targets" />
 </Project>
\ No newline at end of file
diff --git a/src/common.nugetversions.targets b/src/common.nugetversions.targets
index 0f915d51469..bc949206615 100644
--- a/src/common.nugetversions.targets
+++ b/src/common.nugetversions.targets
@@ -27,7 +27,7 @@
       Condition="'$(BuildingInsideVisualStudio)' == 'true'">
 
     <!--Have the [nuget.exe] tool do a restore on the global [packages.config] file for the repository.-->
-    <Exec Command="$(Terminal_NuGetEXE) install $(Terminal_GlobalPackagesConfigPath)" />
+    <Exec Command="$(Terminal_NuGetEXE) install &quot;$(Terminal_GlobalPackagesConfigPath)&quot;" />
 
     <!--Copy this version of [packages.config] to the output directory to allow us to skip this work in the future if nothing changed.-->
     <Copy SourceFiles="$(Terminal_GlobalPackagesConfigPath)"


Test patch: