Repository: microsoft/terminal (language: cpp)

Issue:
Latest compilers emit a ton of C4996 warnings as errors
### Windows Terminal version

main @ [2e91e9c](https://github.com/microsoft/terminal/commit/2e91e9c6debca8915e829592b90ab5c3f13224b8)

### Windows build number

10.0.22621.0

### Other Software

Visual Studio `Version 17.8.0 Preview 3.0 [34118.359.main]`
```
msbuild -version
MSBuild version 17.8.0-preview-23431-02+3c910ba83 for .NET Framework
17.8.0.43102
```

### Steps to reproduce

- Open OpenConsole solution
- Set to x64
- F5

### Expected Behavior

No errors

### Actual Behavior

1,123 C4996 warnings as errors. e.g.:

```
Error	C4996	'stdext::checked_array_iterator<_Ty*>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. 
std::span (since C++20) and gsl::span can be used instead. 
You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.	
fmt	C:\git\terminal\oss\fmt\include\fmt\format.h	359
```


Discussion / hints:
Related: https://github.com/fmtlib/fmt/issues/3540
We currently use 7.1.3 (2 years old? wat). In the 9 versions since then (currently 10.1.1) we've missed:
* compile-time format string checks
* faster format string compilation
* `"{}"_cf` instead of `FMT_COMPILE("{}")`
* smaller PCH
* way faster float and hex formatting
* way faster `format_to`
* ...
Yep we should probably just update that. Thanks!

Related: #15855 

I am committing to not updating our checked-in dependencies until we have a Governance-clean pipeline for doing so :)
BTW I just noticed: Happy round-issue-number to you!

It turns out that the upgrade is a significant pain in the butt, because `fmt` largely removed support for `wchar_t`. Things that don't work anymore:
* Passing `wstring` parameters to `string` formattings and vice versa
* Implicitly casting `hstring` to `wstring_view`

I started working on this in https://github.com/microsoft/terminal/tree/dev/lhecker/16000-fmt-update
I am uncomfortable with the premier C++ formatting library removing support for an entire platform like that. Considering that Windows predominantly uses wide strings, that makes it nearly unfit for purpose.

Do you happen to have any links to docs about them explicitly dropping support?
Hey! I said "largely removed", not "dropped". 😄 And I meant it in the context of our project which uses `char` -> `wchar_t` conversions quite a bit. Maybe I should've worded it better, like "because `fmt` removed parts that we took a significant dependency on".

`fmt` now matches the behavior of `std::format` which doesn't provide a builtin implicit conversion either:
```
error C2338: static_assert failed: 'Cannot format an argument. To make type T formattable, provide a formatter<T> specialization. See N4950 [format.arg.store]/2 and [formatter.requirements].'
```
The same is true for `winrt::hstring` which also fails with the above message with `std::format`.

I don't know which commit(s) removed either of the two features, because there's no commit in `fmt/xchar.h`'s history that has a fitting title, there's no issue with one either, and I'm not sure what to look for when reading the massive `format-inl.h` file.
But it fits the C++ standard behavior so I don't think we're missing out on anything.
I finished fixing all issues and as it turns out, the `wchar_t` / `char` thing was fairly minor. The biggest problem was fixing all those
```cpp
format(RS_(...), ...)
```
which now need to be
```cpp
format(fmt::runtime(RS_(...)), ...)
```
because it now does compile time format checks even without `FMT_COMPILE` (great!), but that doesn't work for `hstring` parameters because `fmt` defines its own `fmt::string_view` class for pre-C++17 compatibility. `fmt::string_view` has an implicit constructor for `std::string_view`, but an `hstring` is only implicitly convertible **to** an `std::string_view`.
Me and my C++ compiler have spent a lot of time today staring out of the window, while the "door stuck" soundtrack played in the back of my head.

Fix patch:
diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt
index fd80a86e42d..22f9268731d 100644
--- a/.github/actions/spelling/expect/expect.txt
+++ b/.github/actions/spelling/expect/expect.txt
@@ -142,8 +142,8 @@ BTNFACE
 bufferout
 buffersize
 buflen
-buildtransitive
 buildsystems
+buildtransitive
 BValue
 bytebuffer
 cac
@@ -2140,6 +2140,7 @@ XBUTTONDOWN
 XBUTTONUP
 XCast
 XCENTER
+xchar
 xcopy
 XCount
 xdy
diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp
index cf294fbd47d..3bac06b1a92 100644
--- a/src/cascadia/TerminalApp/AppActionHandlers.cpp
+++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp
@@ -910,10 +910,8 @@ namespace winrt::TerminalApp::implementation
 
         // Build the commandline to pass to wt for this set of NewTerminalArgs
         // `-w -1` will ensure a new window is created.
-        winrt::hstring cmdline{
-            fmt::format(L"-w -1 new-tab {}",
-                        terminalArgs.ToCommandline().c_str())
-        };
+        const auto commandline = terminalArgs.ToCommandline();
+        winrt::hstring cmdline{ fmt::format(FMT_COMPILE(L"-w -1 new-tab {}"), commandline) };
 
         // Build the args to ShellExecuteEx. We need to use ShellExecuteEx so we
         // can pass the SEE_MASK_NOASYNC flag. That flag allows us to safely
@@ -1107,14 +1105,14 @@ namespace winrt::TerminalApp::implementation
                 {
                     if (const auto& realArgs = args.ActionArgs().try_as<SearchForTextArgs>())
                     {
-                        queryUrl = realArgs.QueryUrl().c_str();
+                        queryUrl = std::wstring_view{ realArgs.QueryUrl() };
                     }
                 }
 
                 // use global default if query URL is unspecified
                 if (queryUrl.empty())
                 {
-                    queryUrl = _settings.GlobalSettings().SearchWebDefaultQueryUrl().c_str();
+                    queryUrl = std::wstring_view{ _settings.GlobalSettings().SearchWebDefaultQueryUrl() };
                 }
 
                 constexpr std::wstring_view queryToken{ L"%s" };
diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp
index dc11b506449..1a73c777c03 100644
--- a/src/cascadia/TerminalApp/AppLogic.cpp
+++ b/src/cascadia/TerminalApp/AppLogic.cpp
@@ -325,7 +325,7 @@ namespace winrt::TerminalApp::implementation
                 //
                 // So DON'T ~give a mouse a cookie~ take a static ref here.
 
-                const winrt::hstring modifiedBasename{ std::filesystem::path{ fileModified }.filename().c_str() };
+                const auto modifiedBasename = std::filesystem::path{ fileModified }.filename();
 
                 if (modifiedBasename == settingsBasename)
                 {
diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp
index 2e6338234ef..b54ee9a5c6f 100644
--- a/src/cascadia/TerminalApp/CommandPalette.cpp
+++ b/src/cascadia/TerminalApp/CommandPalette.cpp
@@ -626,7 +626,7 @@ namespace winrt::TerminalApp::implementation
             automationPeer.RaiseNotificationEvent(
                 Automation::Peers::AutomationNotificationKind::ActionCompleted,
                 Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent,
-                fmt::format(std::wstring_view{ RS_(L"CommandPalette_NestedCommandAnnouncement") }, ParentCommandName()),
+                RS_fmt(L"CommandPalette_NestedCommandAnnouncement", ParentCommandName()),
                 L"CommandPaletteNestingLevelChanged" /* unique name for this notification category */);
         }
     }
@@ -879,7 +879,7 @@ namespace winrt::TerminalApp::implementation
                     Automation::Peers::AutomationNotificationKind::ActionCompleted,
                     Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
                     currentNeedleHasResults ?
-                        winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_MatchesAvailable") }, _filteredActions.Size()) } :
+                        winrt::hstring{ RS_fmt(L"CommandPalette_MatchesAvailable", _filteredActions.Size()) } :
                         NoMatchesText(), // what to announce if results were found
                     L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */);
             }
diff --git a/src/cascadia/TerminalApp/Jumplist.cpp b/src/cascadia/TerminalApp/Jumplist.cpp
index 050fdbb4291..5f3e3f12f77 100644
--- a/src/cascadia/TerminalApp/Jumplist.cpp
+++ b/src/cascadia/TerminalApp/Jumplist.cpp
@@ -121,7 +121,7 @@ void Jumplist::_updateProfiles(IObjectCollection* jumplistItems, winrt::Windows:
     for (const auto& profile : profiles)
     {
         // Craft the arguments following "wt.exe"
-        auto args = fmt::format(L"-p {}", to_hstring(profile.Guid()));
+        auto args = fmt::format(FMT_COMPILE(L"-p {}"), to_hstring(profile.Guid()));
 
         // Create the shell link object for the profile
         const auto normalizedIconPath{ _normalizeIconPath(profile.Icon()) };
diff --git a/src/cascadia/TerminalApp/SnippetsPaneContent.h b/src/cascadia/TerminalApp/SnippetsPaneContent.h
index 19f85559824..b394f94b4e9 100644
--- a/src/cascadia/TerminalApp/SnippetsPaneContent.h
+++ b/src/cascadia/TerminalApp/SnippetsPaneContent.h
@@ -97,7 +97,7 @@ namespace winrt::TerminalApp::implementation
                 {
                     if (const auto& sendInput{ command.ActionAndArgs().Args().try_as<winrt::Microsoft::Terminal::Settings::Model::SendInputArgs>() })
                     {
-                        return winrt::hstring{ til::visualize_nonspace_control_codes(sendInput.Input().c_str()) };
+                        return winrt::hstring{ til::visualize_nonspace_control_codes(std::wstring{ sendInput.Input() }) };
                     }
                 }
             }
diff --git a/src/cascadia/TerminalApp/SuggestionsControl.cpp b/src/cascadia/TerminalApp/SuggestionsControl.cpp
index 366205fc85a..e6f482ac19e 100644
--- a/src/cascadia/TerminalApp/SuggestionsControl.cpp
+++ b/src/cascadia/TerminalApp/SuggestionsControl.cpp
@@ -654,7 +654,7 @@ namespace winrt::TerminalApp::implementation
             automationPeer.RaiseNotificationEvent(
                 Automation::Peers::AutomationNotificationKind::ActionCompleted,
                 Automation::Peers::AutomationNotificationProcessing::CurrentThenMostRecent,
-                fmt::format(std::wstring_view{ RS_(L"SuggestionsControl_NestedCommandAnnouncement") }, ParentCommandName()),
+                RS_fmt(L"SuggestionsControl_NestedCommandAnnouncement", ParentCommandName()),
                 L"SuggestionsControlNestingLevelChanged" /* unique name for this notification category */);
         }
     }
@@ -810,7 +810,7 @@ namespace winrt::TerminalApp::implementation
                 Automation::Peers::AutomationNotificationKind::ActionCompleted,
                 Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
                 currentNeedleHasResults ?
-                    winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"SuggestionsControl_MatchesAvailable") }, _filteredActions.Size()) } :
+                    winrt::hstring{ RS_fmt(L"SuggestionsControl_MatchesAvailable", _filteredActions.Size()) } :
                     NoMatchesText(), // what to announce if results were found
                 L"SuggestionsControlResultAnnouncement" /* unique name for this group of notifications */);
         }
diff --git a/src/cascadia/TerminalApp/TabManagement.cpp b/src/cascadia/TerminalApp/TabManagement.cpp
index 79d830dca1c..2348e70f73a 100644
--- a/src/cascadia/TerminalApp/TabManagement.cpp
+++ b/src/cascadia/TerminalApp/TabManagement.cpp
@@ -1035,7 +1035,7 @@ namespace winrt::TerminalApp::implementation
                 const auto tabTitle = tab.Title();
                 autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
                                                 Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
-                                                fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_Direction") }, tabTitle, newTabIndex + 1),
+                                                RS_fmt(L"TerminalPage_TabMovedAnnouncement_Direction", tabTitle, newTabIndex + 1),
                                                 L"TerminalPageMoveTabWithDirection" /* unique name for this notification category */);
             }
         }
diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp
index b03b7e37210..002886fd3bb 100644
--- a/src/cascadia/TerminalApp/TerminalPage.cpp
+++ b/src/cascadia/TerminalApp/TerminalPage.cpp
@@ -2148,7 +2148,7 @@ namespace winrt::TerminalApp::implementation
                         {
                             autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
                                                             Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
-                                                            fmt::format(std::wstring_view{ RS_(L"TerminalPage_PaneMovedAnnouncement_ExistingWindow2") }, windowId),
+                                                            RS_fmt(L"TerminalPage_PaneMovedAnnouncement_ExistingWindow2", windowId),
                                                             L"TerminalPageMovePaneToExistingWindow" /* unique name for this notification category */);
                         }
                     }
@@ -2183,7 +2183,7 @@ namespace winrt::TerminalApp::implementation
                 const auto tabTitle = targetTab->Title();
                 autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
                                                 Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
-                                                fmt::format(std::wstring_view{ RS_(L"TerminalPage_PaneMovedAnnouncement_ExistingTab") }, tabTitle),
+                                                RS_fmt(L"TerminalPage_PaneMovedAnnouncement_ExistingTab", tabTitle),
                                                 L"TerminalPageMovePaneToExistingTab" /* unique name for this notification category */);
             }
         }
@@ -2283,14 +2283,14 @@ namespace winrt::TerminalApp::implementation
                     {
                         autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
                                                         Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
-                                                        fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_NewWindow") }, tabTitle),
+                                                        RS_fmt(L"TerminalPage_TabMovedAnnouncement_NewWindow", tabTitle),
                                                         L"TerminalPageMoveTabToNewWindow" /* unique name for this notification category */);
                     }
                     else
                     {
                         autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
                                                         Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
-                                                        fmt::format(std::wstring_view{ RS_(L"TerminalPage_TabMovedAnnouncement_Default") }, tabTitle, windowId),
+                                                        RS_fmt(L"TerminalPage_TabMovedAnnouncement_Default", tabTitle, windowId),
                                                         L"TerminalPageMoveTabToExistingWindow" /* unique name for this notification category */);
                     }
                 }
@@ -2831,7 +2831,7 @@ namespace winrt::TerminalApp::implementation
     {
         try
         {
-            auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri().c_str());
+            auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri());
             if (_IsUriSupported(parsed))
             {
                 ShellExecute(nullptr, L"open", eventArgs.Uri().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
@@ -4176,8 +4176,8 @@ namespace winrt::TerminalApp::implementation
     winrt::hstring TerminalPage::KeyboardServiceDisabledText()
     {
         const auto serviceName{ _getTabletServiceName() };
-        const winrt::hstring text{ fmt::format(std::wstring_view(RS_(L"KeyboardServiceWarningText")), serviceName) };
-        return text;
+        const auto text{ RS_fmt(L"KeyboardServiceWarningText", serviceName) };
+        return winrt::hstring{ text };
     }
 
     // Method Description:
@@ -4467,7 +4467,7 @@ namespace winrt::TerminalApp::implementation
 
         // Build the commandline to pass to wt for this set of NewTerminalArgs
         auto cmdline{
-            fmt::format(L"new-tab {}", newTerminalArgs.ToCommandline().c_str())
+            fmt::format(FMT_COMPILE(L"new-tab {}"), newTerminalArgs.ToCommandline())
         };
 
         wil::unique_process_information pi;
@@ -5221,7 +5221,7 @@ namespace winrt::TerminalApp::implementation
         {
             // `this` is safe to use in here.
 
-            _sendDraggedTabToWindow(winrt::hstring{ fmt::format(L"{}", args.TargetWindow()) },
+            _sendDraggedTabToWindow(winrt::to_hstring(args.TargetWindow()),
                                     args.TabIndex(),
                                     std::nullopt);
         }
diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp
index 961df655dd8..566e6b6fbdc 100644
--- a/src/cascadia/TerminalApp/TerminalTab.cpp
+++ b/src/cascadia/TerminalApp/TerminalTab.cpp
@@ -1873,7 +1873,7 @@ namespace winrt::TerminalApp::implementation
             const auto profileName{ control.Settings().ProfileName() };
             if (profileName != Title())
             {
-                return fmt::format(L"{}: {}", profileName, Title()).data();
+                return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"), profileName, Title()) };
             }
         }
 
diff --git a/src/cascadia/TerminalApp/TerminalWindow.cpp b/src/cascadia/TerminalApp/TerminalWindow.cpp
index c04a34affc9..539aa01e93c 100644
--- a/src/cascadia/TerminalApp/TerminalWindow.cpp
+++ b/src/cascadia/TerminalApp/TerminalWindow.cpp
@@ -1362,7 +1362,7 @@ namespace winrt::TerminalApp::implementation
     // - a string for displaying the name of the window.
     winrt::hstring WindowProperties::WindowIdForDisplay() const noexcept
     {
-        return winrt::hstring{ fmt::format(L"{}: {}",
+        return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"),
                                            std::wstring_view(RS_(L"WindowIdLabel")),
                                            _WindowId) };
     }
@@ -1376,7 +1376,7 @@ namespace winrt::TerminalApp::implementation
     winrt::hstring WindowProperties::WindowNameForDisplay() const noexcept
     {
         return _WindowName.empty() ?
-                   winrt::hstring{ fmt::format(L"<{}>", RS_(L"UnnamedWindowName")) } :
+                   winrt::hstring{ fmt::format(FMT_COMPILE(L"<{}>"), RS_(L"UnnamedWindowName")) } :
                    _WindowName;
     }
 
diff --git a/src/cascadia/TerminalConnection/AzureConnection.cpp b/src/cascadia/TerminalConnection/AzureConnection.cpp
index e633e9b80c9..210f7cc06c1 100644
--- a/src/cascadia/TerminalConnection/AzureConnection.cpp
+++ b/src/cascadia/TerminalConnection/AzureConnection.cpp
@@ -37,7 +37,7 @@ static constexpr winrt::guid AzureConnectionType = { 0xd9fcfdfa, 0xa479, 0x412c,
 
 static inline std::wstring _colorize(const unsigned int colorCode, const std::wstring_view text)
 {
-    return fmt::format(L"\x1b[{0}m{1}\x1b[m", colorCode, text);
+    return fmt::format(FMT_COMPILE(L"\x1b[{0}m{1}\x1b[m"), colorCode, text);
 }
 
 // Takes N resource names, loads the first one as a format string, and then
@@ -47,15 +47,18 @@ static inline std::wstring _colorize(const unsigned int colorCode, const std::ws
 template<typename... Args>
 static inline std::wstring _formatResWithColoredUserInputOptions(const std::wstring_view resourceKey, Args&&... args)
 {
-    return fmt::format(std::wstring_view{ GetLibraryResourceString(resourceKey) }, (_colorize(USER_INPUT_COLOR, GetLibraryResourceString(args)))...);
+    const auto format = GetLibraryResourceString(resourceKey);
+    return fmt::format(fmt::runtime(std::wstring_view{ format }), (_colorize(USER_INPUT_COLOR, GetLibraryResourceString(args)))...);
 }
 
 static inline std::wstring _formatTenant(int tenantNumber, const Tenant& tenant)
 {
-    return fmt::format(std::wstring_view{ RS_(L"AzureIthTenant") },
-                       _colorize(USER_INPUT_COLOR, std::to_wstring(tenantNumber)),
-                       _colorize(USER_INFO_COLOR, tenant.DisplayName.value_or(std::wstring{ RS_(L"AzureUnknownTenantName") })),
-                       tenant.DefaultDomain.value_or(tenant.ID)); // use the domain name if possible, ID if not.
+    return RS_fmt(
+        L"AzureIthTenant",
+        _colorize(USER_INPUT_COLOR, std::to_wstring(tenantNumber)),
+        _colorize(USER_INFO_COLOR, tenant.DisplayName.value_or(std::wstring{ RS_(L"AzureUnknownTenantName") })),
+        tenant.DefaultDomain.value_or(tenant.ID) // use the domain name if possible, ID if not.
+    );
 }
 
 namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
@@ -244,7 +247,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
         }
         else // We only transition to Connected when we've established the websocket.
         {
-            auto uri{ fmt::format(L"{}terminals/{}/size?cols={}&rows={}&version=2019-01-01", _cloudShellUri, _terminalID, columns, rows) };
+            auto uri{ fmt::format(FMT_COMPILE(L"{}terminals/{}/size?cols={}&rows={}&version=2019-01-01"), _cloudShellUri, _terminalID, columns, rows) };
 
             WWH::HttpStringContent content{
                 L"",
@@ -851,7 +854,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the response to the device code flow initiation
     WDJ::JsonObject AzureConnection::_GetDeviceCode()
     {
-        auto uri{ fmt::format(L"{}common/oauth2/devicecode", _loginUri) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}common/oauth2/devicecode"), _loginUri) };
         WWH::HttpFormUrlEncodedContent content{
             std::unordered_map<winrt::hstring, winrt::hstring>{
                 { winrt::hstring{ L"client_id" }, winrt::hstring{ AzureClientID } },
@@ -872,7 +875,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - else, throw an exception
     WDJ::JsonObject AzureConnection::_WaitForUser(const winrt::hstring& deviceCode, int pollInterval, int expiresIn)
     {
-        auto uri{ fmt::format(L"{}common/oauth2/token", _loginUri) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}common/oauth2/token"), _loginUri) };
         WWH::HttpFormUrlEncodedContent content{
             std::unordered_map<winrt::hstring, winrt::hstring>{
                 { winrt::hstring{ L"grant_type" }, winrt::hstring{ L"device_code" } },
@@ -923,7 +926,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the response which contains a list of the user's Azure tenants
     void AzureConnection::_PopulateTenantList()
     {
-        auto uri{ fmt::format(L"{}tenants?api-version=2020-01-01", _resourceUri) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}tenants?api-version=2020-01-01"), _resourceUri) };
 
         // Send the request and return the response as a json value
         auto tenantResponse{ _SendRequestReturningJson(uri, nullptr) };
@@ -939,7 +942,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the response with the new tokens
     void AzureConnection::_RefreshTokens()
     {
-        auto uri{ fmt::format(L"{}{}/oauth2/token", _loginUri, _currentTenant->ID) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}{}/oauth2/token"), _loginUri, _currentTenant->ID) };
         WWH::HttpFormUrlEncodedContent content{
             std::unordered_map<winrt::hstring, winrt::hstring>{
                 { winrt::hstring{ L"grant_type" }, winrt::hstring{ L"refresh_token" } },
@@ -962,7 +965,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the user's cloud shell settings
     WDJ::JsonObject AzureConnection::_GetCloudShellUserSettings()
     {
-        auto uri{ fmt::format(L"{}providers/Microsoft.Portal/userSettings/cloudconsole?api-version=2023-02-01-preview", _resourceUri) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}providers/Microsoft.Portal/userSettings/cloudconsole?api-version=2023-02-01-preview"), _resourceUri) };
         return _SendRequestReturningJson(uri, nullptr);
     }
 
@@ -972,7 +975,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the uri for the cloud shell
     winrt::hstring AzureConnection::_GetCloudShell()
     {
-        auto uri{ fmt::format(L"{}providers/Microsoft.Portal/consoles/default?api-version=2023-02-01-preview", _resourceUri) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}providers/Microsoft.Portal/consoles/default?api-version=2023-02-01-preview"), _resourceUri) };
 
         WWH::HttpStringContent content{
             LR"-({"properties": {"osType": "linux"}})-",
@@ -992,7 +995,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
     // - the uri for the terminal
     winrt::hstring AzureConnection::_GetTerminal(const winrt::hstring& shellType)
     {
-        auto uri{ fmt::format(L"{}terminals?cols={}&rows={}&version=2019-01-01&shell={}", _cloudShellUri, _initialCols, _initialRows, shellType) };
+        auto uri{ fmt::format(FMT_COMPILE(L"{}terminals?cols={}&rows={}&version=2019-01-01&shell={}"), _cloudShellUri, _initialCols, _initialRows, shellType) };
 
         WWH::HttpStringContent content{
             L"{}",
diff --git a/src/cascadia/TerminalConnection/ConptyConnection.cpp b/src/cascadia/TerminalConnection/ConptyConnection.cpp
index 5b8cb22028a..23a7e263b84 100644
--- a/src/cascadia/TerminalConnection/ConptyConnection.cpp
+++ b/src/cascadia/TerminalConnection/ConptyConnection.cpp
@@ -14,10 +14,6 @@
 #include "ConptyConnection.g.cpp"
 
 using namespace ::Microsoft::Console;
-using namespace std::string_view_literals;
-
-// Format is: "DecimalResult (HexadecimalForm)"
-static constexpr auto _errorFormat = L"{0} ({0:#010x})"sv;
 
 // Notes:
 // There is a number of ways that the Conpty connection can be terminated (voluntarily or not):
@@ -77,7 +73,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
                 std::set<std::wstring, til::env_key_sorter> keys{};
                 for (const auto item : _environment)
                 {
-                    keys.insert(item.Key().c_str());
+                    keys.insert(std::wstring{ item.Key() });
                 }
                 // add additional env vars
                 for (const auto& key : keys)
@@ -422,16 +418,13 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
         const auto hr = wil::ResultFromCaughtException();
 
         // GH#11556 - make sure to format the error code to this string as an UNSIGNED int
-        winrt::hstring failureText{ fmt::format(std::wstring_view{ RS_(L"ProcessFailedToLaunch") },
-                                                fmt::format(_errorFormat, static_cast<unsigned int>(hr)),
-                                                _commandline) };
+        const auto failureText = RS_fmt(L"ProcessFailedToLaunch", _formatStatus(hr), _commandline);
         TerminalOutput.raise(failureText);
 
         // If the path was invalid, let's present an informative message to the user
         if (hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY))
         {
-            winrt::hstring badPathText{ fmt::format(std::wstring_view{ RS_(L"BadPathText") },
-                                                    _startingDirectory) };
+            const auto badPathText = RS_fmt(L"BadPathText", _startingDirectory);
             TerminalOutput.raise(L"\r\n");
             TerminalOutput.raise(badPathText);
         }
@@ -451,7 +444,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
         try
         {
             // GH#11556 - make sure to format the error code to this string as an UNSIGNED int
-            const auto msg1 = fmt::format(std::wstring_view{ RS_(L"ProcessExited") }, fmt::format(_errorFormat, status));
+            const auto msg1 = RS_fmt(L"ProcessExited", _formatStatus(status));
             const auto msg2 = RS_(L"CtrlDToClose");
             const auto msg = fmt::format(FMT_COMPILE(L"\r\n{}\r\n{}\r\n"), msg1, msg2);
             TerminalOutput.raise(msg);
@@ -459,6 +452,11 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
         CATCH_LOG();
     }
 
+    std::wstring ConptyConnection::_formatStatus(uint32_t status)
+    {
+        return fmt::format(FMT_COMPILE(L"{0} ({0:#010x})"), status);
+    }
+
     // Method Description:
     // - called when the client application (not necessarily its pty) exits for any reason
     void ConptyConnection::_LastConPtyClientDisconnected() noexcept
diff --git a/src/cascadia/TerminalConnection/ConptyConnection.h b/src/cascadia/TerminalConnection/ConptyConnection.h
index 6fd476b0cb0..85f292baad7 100644
--- a/src/cascadia/TerminalConnection/ConptyConnection.h
+++ b/src/cascadia/TerminalConnection/ConptyConnection.h
@@ -60,6 +60,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
 
         HRESULT _LaunchAttachedClient() noexcept;
         void _indicateExitWithStatus(unsigned int status) noexcept;
+        static std::wstring _formatStatus(uint32_t status);
         void _LastConPtyClientDisconnected() noexcept;
 
         til::CoordType _rows = 120;
diff --git a/src/cascadia/TerminalControl/SearchBoxControl.cpp b/src/cascadia/TerminalControl/SearchBoxControl.cpp
index 0a63da28c0e..7cedfb6699e 100644
--- a/src/cascadia/TerminalControl/SearchBoxControl.cpp
+++ b/src/cascadia/TerminalControl/SearchBoxControl.cpp
@@ -487,7 +487,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
         }
         else
         {
-            currentString = fmt::format(L"{}", currentMatch + 1);
+            currentString = fmt::to_wstring(currentMatch + 1);
         }
 
         if (totalMatches > MaximumTotalResultsToShowInStatus)
@@ -496,10 +496,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
         }
         else
         {
-            totalString = fmt::format(L"{}", totalMatches);
+            totalString = fmt::to_wstring(totalMatches);
         }
 
-        return winrt::hstring{ fmt::format(RS_(L"TermControl_NumResults").c_str(), currentString, totalString) };
+        return winrt::hstring{ RS_fmt(L"TermControl_NumResults", currentString, totalString) };
     }
 
     // Method Description:
diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp
index be9de020b54..0cc1930ddda 100644
--- a/src/cascadia/TerminalControl/TermControl.cpp
+++ b/src/cascadia/TerminalControl/TermControl.cpp
@@ -1199,13 +1199,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
         {
         case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
         case HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND):
-            message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PixelShaderNotFound") }, parameter) };
+            message = RS_fmt(L"PixelShaderNotFound", parameter);
             break;
         case D2DERR_SHADER_COMPILE_FAILED:
-            message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PixelShaderCompileFailed") }, parameter) };
+            message = RS_fmt(L"PixelShaderCompileFailed", parameter);
             break;
         case DWRITE_E_NOFONT:
-            message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"RendererErrorFontNotFound") }, parameter) };
+            message = RS_fmt(L"RendererErrorFontNotFound", parameter);
             break;
         case ATLAS_ENGINE_ERROR_MAC_TYPE:
             message = RS_(L"RendererErrorMacType");
@@ -1215,9 +1215,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
             wchar_t buf[512];
             const auto len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buf[0], ARRAYSIZE(buf), nullptr);
             const std::wstring_view msg{ &buf[0], len };
-            std::wstring resourceString = RS_(L"RendererErrorOther").c_str();
             //conditional message construction
-            std::wstring partialMessage = fmt::format(std::wstring_view{ resourceString }, hr, msg);
+            auto partialMessage = RS_fmt(L"RendererErrorOther", hr, msg);
             if (!parameter.empty())
             {
                 fmt::format_to(std::back_inserter(partialMessage), LR"( "{0}")", parameter);
@@ -3773,7 +3772,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
                 automationPeer.RaiseNotificationEvent(
                     AutomationNotificationKind::ItemAdded,
                     AutomationNotificationProcessing::All,
-                    winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"PreviewTextAnnouncement") }, text) },
+                    RS_fmt(L"PreviewTextAnnouncement", text),
                     L"PreviewTextAnnouncement" /* unique name for this group of notifications */);
             }
         }
diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemeViewModel.cpp b/src/cascadia/TerminalSettingsEditor/ColorSchemeViewModel.cpp
index fc6a4bc5afe..fef533a8f50 100644
--- a/src/cascadia/TerminalSettingsEditor/ColorSchemeViewModel.cpp
+++ b/src/cascadia/TerminalSettingsEditor/ColorSchemeViewModel.cpp
@@ -57,7 +57,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
     {
         if (IsDefaultScheme())
         {
-            return hstring{ fmt::format(L"{0} ({1})", Name(), RS_(L"ColorScheme_DefaultTag/Text")) };
+            return hstring{ fmt::format(FMT_COMPILE(L"{} ({})"), Name(), RS_(L"ColorScheme_DefaultTag/Text")) };
         }
         return Name();
     }
diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemesPageViewModel.cpp b/src/cascadia/TerminalSettingsEditor/ColorSchemesPageViewModel.cpp
index a4d17dbb3e6..db30847db18 100644
--- a/src/cascadia/TerminalSettingsEditor/ColorSchemesPageViewModel.cpp
+++ b/src/cascadia/TerminalSettingsEditor/ColorSchemesPageViewModel.cpp
@@ -97,7 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
 
     Editor::ColorSchemeViewModel ColorSchemesPageViewModel::RequestAddNew()
     {
-        const hstring schemeName{ fmt::format(L"Color Scheme {}", _settings.GlobalSettings().ColorSchemes().Size() + 1) };
+        const auto schemeName{ fmt::format(FMT_COMPILE(L"Color Scheme {}"), _settings.GlobalSettings().ColorSchemes().Size() + 1) };
         Model::ColorScheme scheme{ schemeName };
 
         // Add the new color scheme
diff --git a/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp b/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp
index 425d84299b9..dcaaff6e3e4 100644
--- a/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp
+++ b/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp
@@ -49,17 +49,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
         // Append the launch position part
         if (UseDefaultLaunchPosition())
         {
-            result = fmt::format(L"{}, {}", launchModeString, RS_(L"Globals_DefaultLaunchPositionCheckbox/Content"));
+            result = fmt::format(FMT_COMPILE(L"{}, {}"), launchModeString, RS_(L"Globals_DefaultLaunchPositionCheckbox/Content"));
         }
         else
         {
-            const std::wstring xPosString = isnan(InitialPosX()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosX()));
-            const std::wstring yPosString = isnan(InitialPosY()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosY()));
-            result = fmt::format(L"{}, ({},{})", launchModeString, xPosString, yPosString);
+            const auto xPosString = isnan(InitialPosX()) ? RS_(L"Globals_LaunchModeDefault/Content") : winrt::to_hstring(gsl::narrow_cast<int>(InitialPosX()));
+            const auto yPosString = isnan(InitialPosY()) ? RS_(L"Globals_LaunchModeDefault/Content") : winrt::to_hstring(gsl::narrow_cast<int>(InitialPosY()));
+            result = fmt::format(FMT_COMPILE(L"{}, ({},{})"), launchModeString, xPosString, yPosString);
         }
 
         // Append the CenterOnLaunch part
-        result = CenterOnLaunch() ? winrt::hstring{ fmt::format(L"{}, {}", result, RS_(L"Globals_CenterOnLaunchCentered")) } : result;
+        result = CenterOnLaunch() ? winrt::hstring{ fmt::format(FMT_COMPILE(L"{}, {}"), result, RS_(L"Globals_CenterOnLaunchCentered")) } : result;
         return result;
     }
 
diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp
index 825e79c18e0..8a32fbacb31 100644
--- a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp
+++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp
@@ -255,7 +255,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
         if (originTag == Model::OriginTag::Fragment || originTag == Model::OriginTag::Generated)
         {
             // from a fragment extension or generated profile
-            return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) };
+            return hstring{ RS_fmt(L"SettingContainer_OverrideMessageFragmentExtension", source) };
         }
         return RS_(L"SettingContainer_OverrideMessageBaseLayer");
     }
diff --git a/src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp b/src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp
index e4f0205a2dd..4160c55288e 100644
--- a/src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp
+++ b/src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp
@@ -8,6 +8,7 @@
 #include "HashUtils.h"
 
 #include <LibraryResources.h>
+#include <til/static_map.h>
 
 static constexpr std::string_view AdjustFontSizeKey{ "adjustFontSize" };
 static constexpr std::string_view CloseOtherPanesKey{ "closeOtherPanes" };
@@ -105,52 +106,48 @@ static constexpr std::string_view ActionKey{ "action" };
 // This key is reserved to remove a keybinding, instead of mapping it to an action.
 static constexpr std::string_view UnboundKey{ "unbound" };
 
-#define KEY_TO_ACTION_PAIR(action) { action##Key, ShortcutAction::action },
-#define ACTION_TO_KEY_PAIR(action) { ShortcutAction::action, action##Key },
-#define ACTION_TO_SERIALIZERS_PAIR(action) { ShortcutAction::action, { action##Args::FromJson, action##Args::ToJson } },
-
 namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 {
     using namespace ::Microsoft::Terminal::Settings::Model;
 
-    // Specifically use a map here over an unordered_map. We want to be able to
-    // iterate over these entries in-order when we're serializing the keybindings.
-    // HERE BE DRAGONS:
-    // These are string_views that are being used as keys. These string_views are
-    // just pointers to other strings. This could be dangerous, if the map outlived
-    // the actual strings being pointed to. However, since both these strings and
-    // the map are all const for the lifetime of the app, we have nothing to worry
-    // about here.
-    const std::map<std::string_view, ShortcutAction, std::less<>> ActionAndArgs::ActionKeyNamesMap{
+    using ParseActionFunction = FromJsonResult (*)(const Json::Value&);
+    using SerializeActionFunction = Json::Value (*)(const IActionArgs&);
+
+    using KeyToActionPair = std::pair<std::string_view, ShortcutAction>;
+    using ActionToKeyPair = std::pair<ShortcutAction, std::string_view>;
+    using SerializersPair = std::pair<ParseActionFunction, SerializeActionFunction>;
+    using ActionToSerializersPair = std::pair<ShortcutAction, SerializersPair>;
+
+#define KEY_TO_ACTION_PAIR(action) KeyToActionPair{ action##Key, ShortcutAction::action },
+#define ACTION_TO_KEY_PAIR(action) ActionToKeyPair{ ShortcutAction::action, action##Key },
+#define ACTION_TO_SERIALIZERS_PAIR(action) ActionToSerializersPair{ ShortcutAction::action, { action##Args::FromJson, action##Args::ToJson } },
+
+    static constexpr til::static_map ActionKeyNamesMap{
 #define ON_ALL_ACTIONS(action) KEY_TO_ACTION_PAIR(action)
         ALL_SHORTCUT_ACTIONS
     // Don't include the INTERNAL_SHORTCUT_ACTIONS here
 #undef ON_ALL_ACTIONS
     };
 
-    static const std::map<ShortcutAction, std::string_view, std::less<>> ActionToStringMap{
+    static constexpr til::static_map ActionToStringMap{
 #define ON_ALL_ACTIONS(action) ACTION_TO_KEY_PAIR(action)
         ALL_SHORTCUT_ACTIONS
     // Don't include the INTERNAL_SHORTCUT_ACTIONS here
 #undef ON_ALL_ACTIONS
     };
 
-    using ParseResult = std::tuple<IActionArgs, std::vector<SettingsLoadWarnings>>;
-    using ParseActionFunction = std::function<ParseResult(const Json::Value&)>;
-    using SerializeActionFunction = std::function<Json::Value(IActionArgs)>;
-
     // This is a map of ShortcutAction->{function<IActionArgs(Json::Value)>, function<Json::Value(IActionArgs)>. It holds
     // a set of (de)serializer functions that can be used to (de)serialize an IActionArgs
     // from json. Each type of IActionArgs that can accept arbitrary args should be
     // placed into this map, with the corresponding deserializer function as the
     // value.
-    static const std::unordered_map<ShortcutAction, std::pair<ParseActionFunction, SerializeActionFunction>> argSerializerMap{
+    static constexpr til::static_map argSerializerMap{
 
         // These are special cases.
         // - QuakeMode: deserializes into a GlobalSummon, so we don't need a serializer
         // - Invalid: has no args
-        { ShortcutAction::QuakeMode, { GlobalSummonArgs::QuakeModeFromJson, nullptr } },
-        { ShortcutAction::Invalid, { nullptr, nullptr } },
+        ActionToSerializersPair{ ShortcutAction::QuakeMode, { &GlobalSummonArgs::QuakeModeFromJson, nullptr } },
+        ActionToSerializersPair{ ShortcutAction::Invalid, { nullptr, nullptr } },
 
 #define ON_ALL_ACTIONS_WITH_ARGS(action) ACTION_TO_SERIALIZERS_PAIR(action)
         ALL_SHORTCUT_ACTIONS_WITH_ARGS
@@ -198,8 +195,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         // Try matching the command to one we have. If we can't find the
         // action name in our list of names, let's just unbind that key.
-        const auto found = ActionAndArgs::ActionKeyNamesMap.find(actionString);
-        return found != ActionAndArgs::ActionKeyNamesMap.end() ? found->second : ShortcutAction::Invalid;
+        const auto found = ActionKeyNamesMap.find(actionString);
+        return found != ActionKeyNamesMap.end() ? found->second : ShortcutAction::Invalid;
     }
 
     // Method Description:
@@ -468,7 +465,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (_Action != ShortcutAction::Invalid)
         {
             auto actionKeyString = ActionToStringMap.find(_Action)->second;
-            auto result = fmt::format(FMT_COMPILE(L"User.{}"), actionKeyString);
+            auto result = fmt::format(FMT_COMPILE(L"User.{}"), winrt::to_hstring(actionKeyString));
             if (_Args)
             {
                 // If there are args, we need to append the hash of the args
diff --git a/src/cascadia/TerminalSettingsModel/ActionAndArgs.h b/src/cascadia/TerminalSettingsModel/ActionAndArgs.h
index 9c841ca727c..cc62ee67310 100644
--- a/src/cascadia/TerminalSettingsModel/ActionAndArgs.h
+++ b/src/cascadia/TerminalSettingsModel/ActionAndArgs.h
@@ -11,7 +11,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 {
     struct ActionAndArgs : public ActionAndArgsT<ActionAndArgs>
     {
-        static const std::map<std::string_view, ShortcutAction, std::less<>> ActionKeyNamesMap;
         static winrt::com_ptr<ActionAndArgs> FromJson(const Json::Value& json,
                                                       std::vector<SettingsLoadWarnings>& warnings);
         static Json::Value ToJson(const Model::ActionAndArgs& val);
diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
index d018b6019e4..57889ec6fd1 100644
--- a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
+++ b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
@@ -60,82 +60,82 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 {
     winrt::hstring NewTerminalArgs::GenerateName() const
     {
-        std::wstringstream ss;
+        std::wstring str;
 
         if (!Profile().empty())
         {
-            ss << fmt::format(L"profile: {}, ", Profile());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile: {}, "), Profile());
         }
         else if (ProfileIndex())
         {
-            ss << fmt::format(L"profile index: {}, ", ProfileIndex().Value());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile index: {}, "), ProfileIndex().Value());
         }
 
         if (!Commandline().empty())
         {
-            ss << fmt::format(L"commandline: {}, ", Commandline());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"commandline: {}, "), Commandline());
         }
 
         if (!StartingDirectory().empty())
         {
-            ss << fmt::format(L"directory: {}, ", StartingDirectory());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"directory: {}, "), StartingDirectory());
         }
 
         if (!TabTitle().empty())
         {
-            ss << fmt::format(L"title: {}, ", TabTitle());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"title: {}, "), TabTitle());
         }
 
         if (TabColor())
         {
             const til::color tabColor{ TabColor().Value() };
-            ss << fmt::format(L"tabColor: {}, ", tabColor.ToHexString(true));
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"tabColor: {}, "), tabColor.ToHexString(true));
         }
         if (!ColorScheme().empty())
         {
-            ss << fmt::format(L"colorScheme: {}, ", ColorScheme());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"colorScheme: {}, "), ColorScheme());
         }
 
         if (SuppressApplicationTitle())
         {
             if (SuppressApplicationTitle().Value())
             {
-                ss << fmt::format(L"suppress application title, ");
+                str.append(L"suppress application title, ");
             }
             else
             {
-                ss << fmt::format(L"use application title, ");
+                str.append(L"use application title, ");
             }
         }
 
         if (Elevate())
         {
-            ss << fmt::format(L"elevate: {}, ", Elevate().Value());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"elevate: {}, "), Elevate().Value());
         }
 
-        auto s = ss.str();
-        if (s.empty())
+        if (str.empty())
         {
-            return L"";
+            return {};
         }
 
         // Chop off the last ", "
-        return winrt::hstring{ s.substr(0, s.size() - 2) };
+        str.resize(str.size() - 2);
+        return winrt::hstring{ str };
     }
 
     winrt::hstring NewTerminalArgs::ToCommandline() const
     {
-        std::wstringstream ss;
+        std::wstring str;
 
         if (!Profile().empty())
         {
-            ss << fmt::format(L"--profile \"{}\" ", Profile());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--profile \"{}\" "), Profile());
         }
 
         if (const auto id = SessionId(); id != winrt::guid{})
         {
-            const auto str = ::Microsoft::Console::Utils::GuidToString(id);
-            ss << fmt::format(L"--sessionId \"{}\" ", str);
+            const auto idStr = ::Microsoft::Console::Utils::GuidToString(id);
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--sessionId \"{}\" "), idStr);
         }
 
         // The caller is always expected to provide the evaluated profile in the
@@ -143,105 +143,104 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         //
         // else if (ProfileIndex())
         // {
-        //     ss << fmt::format(L"profile index: {}, ", ProfileIndex().Value());
+        //     fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"profile index: {}, "), ProfileIndex().Value());
         // }
 
         if (!StartingDirectory().empty())
         {
-            ss << fmt::format(L"--startingDirectory {} ", QuoteAndEscapeCommandlineArg(StartingDirectory()));
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--startingDirectory {} "), QuoteAndEscapeCommandlineArg(StartingDirectory()));
         }
 
         if (!TabTitle().empty())
         {
-            ss << fmt::format(L"--title {} ", QuoteAndEscapeCommandlineArg(TabTitle()));
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--title {} "), QuoteAndEscapeCommandlineArg(TabTitle()));
         }
 
         if (TabColor())
         {
             const til::color tabColor{ TabColor().Value() };
-            ss << fmt::format(L"--tabColor \"{}\" ", tabColor.ToHexString(true));
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--tabColor \"{}\" "), tabColor.ToHexString(true));
         }
 
         if (SuppressApplicationTitle())
         {
             if (SuppressApplicationTitle().Value())
             {
-                ss << fmt::format(L"--suppressApplicationTitle ");
+                str.append(L"--suppressApplicationTitle ");
             }
             else
             {
-                ss << fmt::format(L"--useApplicationTitle ");
+                str.append(L"--useApplicationTitle ");
             }
         }
 
         if (!ColorScheme().empty())
         {
-            ss << fmt::format(L"--colorScheme {} ", QuoteAndEscapeCommandlineArg(ColorScheme()));
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"--colorScheme {} "), QuoteAndEscapeCommandlineArg(ColorScheme()));
         }
 
         if (!Commandline().empty())
         {
-            ss << fmt::format(L"-- \"{}\" ", Commandline());
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"-- \"{}\" "), Commandline());
         }
 
-        auto s = ss.str();
-        if (s.empty())
+        if (str.empty())
         {
-            return L"";
+            return {};
         }
 
         // Chop off the last " "
-        return winrt::hstring{ s.substr(0, s.size() - 1) };
+        str.resize(str.size() - 1);
+        return winrt::hstring{ str };
     }
 
     winrt::hstring CopyTextArgs::GenerateName() const
     {
-        std::wstringstream ss;
+        std::wstring str;
 
         if (SingleLine())
         {
-            ss << RS_(L"CopyTextAsSingleLineCommandKey").c_str();
+            str.append(RS_(L"CopyTextAsSingleLineCommandKey"));
         }
         else
         {
-            ss << RS_(L"CopyTextCommandKey").c_str();
+            str.append(RS_(L"CopyTextCommandKey"));
         }
 
         if (!DismissSelection())
         {
-            ss << L", dismissSelection: false";
+            str.append(L", dismissSelection: false");
         }
 
         if (CopyFormatting())
         {
-            ss << L", copyFormatting: ";
+            str.append(L", copyFormatting: ");
             if (CopyFormatting().Value() == CopyFormat::All)
             {
-                ss << L"all, ";
+                str.append(L"all, ");
             }
             else if (CopyFormatting().Value() == static_cast<CopyFormat>(0))
             {
-                ss << L"none, ";
+                str.append(L"none, ");
             }
             else
             {
                 if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::HTML))
                 {
-                    ss << L"html, ";
+                    str.append(L"html, ");
                 }
 
                 if (WI_IsFlagSet(CopyFormatting().Value(), CopyFormat::RTF))
                 {
-                    ss << L"rtf, ";
+                    str.append(L"rtf, ");
                 }
             }
 
-            // Chop off the last ","
-            auto result = ss.str();
-            return winrt::hstring{ result.substr(0, result.size() - 2) };
+            // Chop off the last ", "
+            str.resize(str.size() - 2);
         }
 
-        return winrt::hstring{ ss.str() };
+        return winrt::hstring{ str };
     }
 
     winrt::hstring NewTabArgs::GenerateName() const
@@ -257,7 +256,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             return RS_(L"NewTabCommandKey");
         }
         return winrt::hstring{
-            fmt::format(L"{}, {}", RS_(L"NewTabCommandKey"), newTerminalArgsStr)
+            fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NewTabCommandKey"), newTerminalArgsStr)
         };
     }
 
@@ -273,11 +272,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
                 return RS_(L"MovePaneToNewWindowCommandKey");
             }
             return winrt::hstring{
-                fmt::format(L"{}, window:{}, tab index:{}", RS_(L"MovePaneCommandKey"), Window(), TabIndex())
+                fmt::format(FMT_COMPILE(L"{}, window:{}, tab index:{}"), RS_(L"MovePaneCommandKey"), Window(), TabIndex())
             };
         }
         return winrt::hstring{
-            fmt::format(L"{}, tab index:{}", RS_(L"MovePaneCommandKey"), TabIndex())
+            fmt::format(FMT_COMPILE(L"{}, tab index:{}"), RS_(L"MovePaneCommandKey"), TabIndex())
         };
     }
 
@@ -289,7 +288,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         }
 
         return winrt::hstring{
-            fmt::format(L"{}, index:{}", RS_(L"SwitchToTabCommandKey"), TabIndex())
+            fmt::format(FMT_COMPILE(L"{}, index:{}"), RS_(L"SwitchToTabCommandKey"), TabIndex())
         };
     }
 
@@ -311,10 +310,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             directionString = RS_(L"DirectionDown");
             break;
         }
-        return winrt::hstring{
-            fmt::format(std::wstring_view(RS_(L"ResizePaneWithArgCommandKey")),
-                        directionString)
-        };
+        return winrt::hstring{ RS_fmt(L"ResizePaneWithArgCommandKey", directionString) };
     }
 
     winrt::hstring MoveFocusArgs::GenerateName() const
@@ -348,10 +344,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             return RS_(L"MoveFocusChildPane");
         }
 
-        return winrt::hstring{
-            fmt::format(std::wstring_view(RS_(L"MoveFocusWithArgCommandKey")),
-                        directionString)
-        };
+        return winrt::hstring{ RS_fmt(L"MoveFocusWithArgCommandKey", directionString) };
     }
 
     winrt::hstring SwapPaneArgs::GenerateName() const
@@ -381,10 +374,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             return RS_(L"SwapPaneFirstPane");
         }
 
-        return winrt::hstring{
-            fmt::format(std::wstring_view(RS_(L"SwapPaneWithArgCommandKey")),
-                        directionString)
-        };
+        return winrt::hstring{ RS_fmt(L"SwapPaneWithArgCommandKey", directionString) };
     }
 
     winrt::hstring AdjustFontSizeArgs::GenerateName() const
@@ -395,19 +385,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // * Decrease font size, amount: {delta}"
         if (Delta() < 0)
         {
-            return Delta() == -1 ? RS_(L"DecreaseFontSizeCommandKey") :
-                                   winrt::hstring{
-                                       fmt::format(std::wstring_view(RS_(L"DecreaseFontSizeWithAmountCommandKey")),
-                                                   -Delta())
-                                   };
+            return Delta() == -1 ? RS_(L"DecreaseFontSizeCommandKey") : winrt::hstring{ RS_fmt(L"DecreaseFontSizeWithAmountCommandKey", -Delta()) };
         }
         else
         {
-            return Delta() == 1 ? RS_(L"IncreaseFontSizeCommandKey") :
-                                  winrt::hstring{
-                                      fmt::format(std::wstring_view(RS_(L"IncreaseFontSizeWithAmountCommandKey")),
-                                                  Delta())
-                                  };
+            return Delta() == 1 ? RS_(L"IncreaseFontSizeCommandKey") : winrt::hstring{ RS_fmt(L"IncreaseFontSizeWithAmountCommandKey", Delta()) };
         }
     }
 
@@ -416,8 +398,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // The string will be similar to the following:
         // * "Send Input: ...input..."
 
-        auto escapedInput = til::visualize_control_codes(Input());
-        auto name = fmt::format(std::wstring_view(RS_(L"SendInputCommandKey")), escapedInput);
+        const auto escapedInput = til::visualize_control_codes(Input());
+        const auto name = RS_fmt(L"SendInputCommandKey", escapedInput);
         return winrt::hstring{ name };
     }
 
@@ -432,38 +414,38 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // If this is a "duplicate pane" action, then the new terminal arguments
         // will be omitted (as they're unused)
 
-        std::wstringstream ss;
+        std::wstring str;
         if (SplitMode() == SplitType::Duplicate)
         {
-            ss << std::wstring_view(RS_(L"DuplicatePaneCommandKey"));
+            str.append(RS_(L"DuplicatePaneCommandKey"));
         }
         else
         {
-            ss << std::wstring_view(RS_(L"SplitPaneCommandKey"));
+            str.append(RS_(L"SplitPaneCommandKey"));
         }
-        ss << L", ";
+        str.append(L", ");
 
         // This text is intentionally _not_ localized, to attempt to mirror the
         // exact syntax that the property would have in JSON.
         switch (SplitDirection())
         {
         case SplitDirection::Up:
-            ss << L"split: up, ";
+            str.append(L"split: up, ");
             break;
         case SplitDirection::Right:
-            ss << L"split: right, ";
+            str.append(L"split: right, ");
             break;
         case SplitDirection::Down:
-            ss << L"split: down, ";
+            str.append(L"split: down, ");
             break;
         case SplitDirection::Left:
-            ss << L"split: left, ";
+            str.append(L"split: left, ");
             break;
         }
 
         if (SplitSize() != .5f)
         {
-            ss << L"size: " << (SplitSize() * 100) << L"%, ";
+            fmt::format_to(std::back_inserter(str), FMT_COMPILE(L"size: {:.2f}%, "), SplitSize() * 100);
         }
 
         winrt::hstring newTerminalArgsStr;
@@ -474,13 +456,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 
         if (SplitMode() != SplitType::Duplicate && !newTerminalArgsStr.empty())
         {
-            ss << newTerminalArgsStr.c_str();
-            ss << L", ";
+            str.append(newTerminalArgsStr);
+            str.append(L", ");
         }
 
         // Chop off the last ", "
-        auto s = ss.str();
-        return winrt::hstring{ s.substr(0, s.size() - 2) };
+        str.resize(str.size() - 2);
+        return winrt::hstring{ str };
     }
 
     winrt::hstring OpenSettingsArgs::GenerateName() const
@@ -531,10 +513,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // "Set color scheme to "{_SchemeName}""
         if (!SchemeName().empty())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"SetColorSchemeCommandKey")),
-                            SchemeName().c_str())
-            };
+            return winrt::hstring{ RS_fmt(L"SetColorSchemeCommandKey", SchemeName()) };
         }
         return L"";
     }
@@ -546,10 +525,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (TabColor())
         {
             til::color tabColor{ TabColor().Value() };
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"SetTabColorCommandKey")),
-                            tabColor.ToHexString(true))
-            };
+            return winrt::hstring{ RS_fmt(L"SetTabColorCommandKey", tabColor.ToHexString(true)) };
         }
 
         return RS_(L"ResetTabColorCommandKey");
@@ -561,10 +537,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // "Reset tab title"
         if (!Title().empty())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"RenameTabCommandKey")),
-                            Title().c_str())
-            };
+            return winrt::hstring{ RS_fmt(L"RenameTabCommandKey", Title()) };
         }
         return RS_(L"ResetTabNameCommandKey");
     }
@@ -574,10 +547,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // "Run commandline "{_Commandline}" in this window"
         if (!Commandline().empty())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"ExecuteCommandlineCommandKey")),
-                            Commandline().c_str())
-            };
+            return winrt::hstring{ RS_fmt(L"ExecuteCommandlineCommandKey", Commandline()) };
         }
         return L"";
     }
@@ -587,10 +557,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (Index())
         {
             // "Close tabs other than index {0}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"CloseOtherTabsCommandKey")),
-                            Index().Value())
-            };
+            return winrt::hstring{ RS_fmt(L"CloseOtherTabsCommandKey", Index().Value()) };
         }
         return RS_(L"CloseOtherTabsDefaultCommandKey");
     }
@@ -600,10 +567,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (Index())
         {
             // "Close tabs after index {0}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"CloseTabsAfterCommandKey")),
-                            Index().Value())
-            };
+            return winrt::hstring{ RS_fmt(L"CloseTabsAfterCommandKey", Index().Value()) };
         }
         return RS_(L"CloseTabsAfterDefaultCommandKey");
     }
@@ -613,10 +577,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (Index())
         {
             // "Close tab at index {0}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"CloseTabAtIndexCommandKey")),
-                            Index().Value())
-            };
+            return winrt::hstring{ RS_fmt(L"CloseTabAtIndexCommandKey", Index().Value()) };
         }
         return RS_(L"CloseTabCommandKey");
     }
@@ -625,10 +586,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (RowsToScroll())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"ScrollUpSeveralRowsCommandKey")),
-                            RowsToScroll().Value())
-            };
+            return winrt::hstring{ RS_fmt(L"ScrollUpSeveralRowsCommandKey", RowsToScroll().Value()) };
         }
         return RS_(L"ScrollUpCommandKey");
     }
@@ -637,10 +595,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (RowsToScroll())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"ScrollDownSeveralRowsCommandKey")),
-                            RowsToScroll().Value())
-            };
+            return winrt::hstring{ RS_fmt(L"ScrollDownSeveralRowsCommandKey", RowsToScroll().Value()) };
         }
         return RS_(L"ScrollDownCommandKey");
     }
@@ -666,10 +621,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (Color())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"AddMarkWithColorCommandKey")),
-                            til::color{ Color().Value() }.ToHexString(true))
-            };
+            return winrt::hstring{ RS_fmt(L"AddMarkWithColorCommandKey", til::color{ Color().Value() }.ToHexString(true)) };
         }
         else
         {
@@ -685,10 +637,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             {
                 return RS_(L"MoveTabToNewWindowCommandKey");
             }
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"MoveTabToWindowCommandKey")),
-                            Window())
-            };
+            return winrt::hstring{ RS_fmt(L"MoveTabToWindowCommandKey", Window()) };
         }
 
         winrt::hstring directionString;
@@ -701,10 +650,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             directionString = RS_(L"MoveTabDirectionBackward");
             break;
         }
-        return winrt::hstring{
-            fmt::format(std::wstring_view(RS_(L"MoveTabCommandKey")),
-                        directionString)
-        };
+        return winrt::hstring{ RS_fmt(L"MoveTabCommandKey", directionString) };
     }
 
     winrt::hstring ToggleCommandPaletteArgs::GenerateName() const
@@ -718,42 +664,40 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 
     winrt::hstring SuggestionsArgs::GenerateName() const
     {
-        std::wstringstream ss;
-        ss << RS_(L"SuggestionsCommandKey").c_str();
+        std::wstring str;
+        str.append(RS_(L"SuggestionsCommandKey"));
 
         if (UseCommandline())
         {
-            ss << L", useCommandline:true";
+            str.append(L", useCommandline:true");
         }
 
         // All of the source values will leave a trailing ", " that we need to chop later:
-        ss << L", source: ";
+        str.append(L", source: ");
         const auto source = Source();
         if (source == SuggestionsSource::All)
         {
-            ss << L"all, ";
+            str.append(L"all, ");
         }
         else if (source == static_cast<SuggestionsSource>(0))
         {
-            ss << L"none, ";
+            str.append(L"none, ");
         }
         else
         {
             if (WI_IsFlagSet(source, SuggestionsSource::Tasks))
             {
-                ss << L"tasks, ";
+                str.append(L"tasks, ");
             }
 
             if (WI_IsFlagSet(source, SuggestionsSource::CommandHistory))
             {
-                ss << L"commandHistory, ";
+                str.append(L"commandHistory, ");
             }
         }
         // Chop off the last ","
-        auto result = ss.str();
-        // use `resize`, to avoid duplicating the entire string. (substr doesn't create a view.)
-        result.resize(result.size() - 2);
-        return winrt::hstring{ result };
+        str.resize(str.size() - 2);
+        return winrt::hstring{ str };
     }
 
     winrt::hstring FindMatchArgs::GenerateName() const
@@ -780,9 +724,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         {
             return RS_(L"NewWindowCommandKey");
         }
-        return winrt::hstring{
-            fmt::format(L"{}, {}", RS_(L"NewWindowCommandKey"), newTerminalArgsStr)
-        };
+        return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NewWindowCommandKey"), newTerminalArgsStr) };
     }
 
     winrt::hstring PrevTabArgs::GenerateName() const
@@ -793,7 +735,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         }
 
         const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order";
-        return winrt::hstring(fmt::format(L"{}, {}", RS_(L"PrevTabCommandKey"), mode));
+        return winrt::hstring(fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"PrevTabCommandKey"), mode));
     }
 
     winrt::hstring NextTabArgs::GenerateName() const
@@ -804,7 +746,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         }
 
         const auto mode = SwitcherMode().Value() == TabSwitcherMode::MostRecentlyUsed ? L"most recently used" : L"in order";
-        return winrt::hstring(fmt::format(L"{}, {}", RS_(L"NextTabCommandKey"), mode));
+        return winrt::hstring(fmt::format(FMT_COMPILE(L"{}, {}"), RS_(L"NextTabCommandKey"), mode));
     }
 
     winrt::hstring RenameWindowArgs::GenerateName() const
@@ -813,10 +755,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         // "Clear window name"
         if (!Name().empty())
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"RenameWindowCommandKey")),
-                            Name().c_str())
-            };
+            return winrt::hstring{ RS_fmt(L"RenameWindowCommandKey", Name()) };
         }
         return RS_(L"ResetWindowNameCommandKey");
     }
@@ -832,10 +771,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 
         try
         {
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"SearchForTextCommandKey")),
-                            Windows::Foundation::Uri(QueryUrl()).Domain().c_str())
-            };
+            return winrt::hstring{ RS_fmt(L"SearchForTextCommandKey", Windows::Foundation::Uri(QueryUrl()).Domain()) };
         }
         CATCH_LOG();
 
@@ -854,26 +790,22 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             return RS_(L"QuakeModeCommandKey");
         }
 
-        std::wstringstream ss;
-        ss << std::wstring_view(RS_(L"GlobalSummonCommandKey"));
+        std::wstring str{ RS_(L"GlobalSummonCommandKey") };
 
         // "Summon the Terminal window"
         // "Summon the Terminal window, name:\"{_Name}\""
         if (!Name().empty())
         {
-            ss << L", name: ";
-            ss << std::wstring_view(Name());
+            str.append(L", name: ");
+            str.append(Name());
         }
-        return winrt::hstring{ ss.str() };
+        return winrt::hstring{ str };
     }
 
     winrt::hstring FocusPaneArgs::GenerateName() const
     {
         // "Focus pane {Id}"
-        return winrt::hstring{
-            fmt::format(std::wstring_view(RS_(L"FocusPaneCommandKey")),
-                        Id())
-        };
+        return winrt::hstring{ RS_fmt(L"FocusPaneCommandKey", Id()) };
     }
 
     winrt::hstring ExportBufferArgs::GenerateName() const
@@ -881,10 +813,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         if (!Path().empty())
         {
             // "Export text to {path}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"ExportBufferToPathCommandKey")),
-                            Path())
-            };
+            return winrt::hstring{ RS_fmt(L"ExportBufferToPathCommandKey", Path()) };
         }
         else
         {
@@ -924,27 +853,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
             if (Opacity() >= 0)
             {
                 // "Increase background opacity by {Opacity}%"
-                return winrt::hstring{
-                    fmt::format(std::wstring_view(RS_(L"IncreaseOpacityCommandKey")),
-                                Opacity())
-                };
+                return winrt::hstring{ RS_fmt(L"IncreaseOpacityCommandKey", Opacity()) };
             }
             else
             {
                 // "Decrease background opacity by {Opacity}%"
-                return winrt::hstring{
-                    fmt::format(std::wstring_view(RS_(L"DecreaseOpacityCommandKey")),
-                                Opacity())
-                };
+                return winrt::hstring{ RS_fmt(L"DecreaseOpacityCommandKey", Opacity()) };
             }
         }
         else
         {
             // "Set background opacity to {Opacity}%"
-            return winrt::hstring{
-                fmt::format(std::wstring_view(RS_(L"AdjustOpacityCommandKey")),
-                            Opacity())
-            };
+            return winrt::hstring{ RS_fmt(L"AdjustOpacityCommandKey", Opacity()) };
         }
     }
 
@@ -952,21 +872,19 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (Feature_SaveSnippet::IsEnabled())
         {
-            std::wstringstream ss;
-
-            ss << RS_(L"SaveSnippetNamePrefix").c_str() << L" commandline: " << Commandline().c_str();
+            auto str = fmt::format(FMT_COMPILE(L"{} commandline: {}"), RS_(L"SaveSnippetNamePrefix"), Commandline());
 
             if (!Name().empty())
             {
-                ss << L", name: " << Name().c_str();
+                fmt::format_to(std::back_inserter(str), FMT_COMPILE(L", name: {}"), Name());
             }
 
             if (!KeyChord().empty())
             {
-                ss << L", keyChord " << KeyChord().c_str();
+                fmt::format_to(std::back_inserter(str), FMT_COMPILE(L", keyChord {}"), KeyChord());
             }
 
-            return winrt::hstring{ ss.str() };
+            return winrt::hstring{ str };
         }
         return L"";
     }
@@ -1039,7 +957,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
         auto matchModeStr = winrt::hstring{};
         if (MatchMode() == Core::MatchMode::All)
         {
-            matchModeStr = fmt::format(L", {}", RS_(L"ColorSelection_allMatches")); // ", all matches"
+            matchModeStr = fmt::format(FMT_COMPILE(L", {}"), RS_(L"ColorSelection_allMatches")); // ", all matches"
         }
 
         const auto foreground = Foreground();
@@ -1058,31 +976,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 
         if (foreground && backgroundIsBoring)
         {
-            const auto str = RS_(L"ColorSelection_fg_action"); // "Color selection, foreground: {0}{1}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view{ str }, fgStr, matchModeStr)
-            };
+            // "Color selection, foreground: {0}{1}"
+            return winrt::hstring{ RS_fmt(L"ColorSelection_fg_action", fgStr, matchModeStr) };
         }
         else if (background && foregroundIsBoring)
         {
-            const auto str = RS_(L"ColorSelection_bg_action"); // "Color selection, background: {0}{1}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view{ str }, bgStr, matchModeStr)
-            };
+            // "Color selection, background: {0}{1}"
+            return winrt::hstring{ RS_fmt(L"ColorSelection_bg_action", bgStr, matchModeStr) };
         }
         else if (foreground && background)
         {
-            const auto str = RS_(L"ColorSelection_fg_bg_action"); // "Color selection, foreground: {0}, background: {1}{2}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view{ str }, fgStr, bgStr, matchModeStr)
-            };
+            // "Color selection, foreground: {0}, background: {1}{2}"
+            return winrt::hstring{ RS_fmt(L"ColorSelection_fg_bg_action", fgStr, bgStr, matchModeStr) };
         }
         else
         {
-            const auto str = RS_(L"ColorSelection_default_action"); // "Color selection, (default foreground/background){0}"
-            return winrt::hstring{
-                fmt::format(std::wstring_view{ str }, matchModeStr)
-            };
+            // "Color selection, (default foreground/background){0}"
+            return winrt::hstring{ RS_fmt(L"ColorSelection_default_action", matchModeStr) };
         }
     }
 
diff --git a/src/cascadia/TerminalSettingsModel/ActionMap.cpp b/src/cascadia/TerminalSettingsModel/ActionMap.cpp
index 5090733342a..972f428aead 100644
--- a/src/cascadia/TerminalSettingsModel/ActionMap.cpp
+++ b/src/cascadia/TerminalSettingsModel/ActionMap.cpp
@@ -845,7 +845,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
                 // UI easier.
 
                 const auto escapedInput = til::visualize_nonspace_control_codes(std::wstring{ inputString });
-                const auto name = fmt::format(std::wstring_view(RS_(L"SendInputCommandKey")), escapedInput);
+                const auto name = RS_fmt(L"SendInputCommandKey", escapedInput);
                 copy->Name(winrt::hstring{ name });
             }
 
diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp
index 8607a811a73..5a9fb2a736a 100644
--- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp
+++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp
@@ -224,7 +224,7 @@ Model::Profile CascadiaSettings::CreateNewProfile()
     for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; candidateIndex++)
     {
         // There is a theoretical unsigned integer wraparound, which is OK
-        newName = fmt::format(L"Profile {}", count + candidateIndex);
+        newName = fmt::format(FMT_COMPILE(L"Profile {}"), count + candidateIndex);
         if (std::none_of(begin(_allProfiles), end(_allProfiles), [&](auto&& profile) { return profile.Name() == newName; }))
         {
             break;
@@ -265,7 +265,7 @@ Model::Profile CascadiaSettings::DuplicateProfile(const Model::Profile& source)
 {
     THROW_HR_IF_NULL(E_INVALIDARG, source);
 
-    auto newName = fmt::format(L"{} ({})", source.Name(), RS_(L"CopySuffix"));
+    auto newName = fmt::format(FMT_COMPILE(L"{} ({})"), source.Name(), RS_(L"CopySuffix"));
 
     // Check if this name already exists and if so, append a number
     for (uint32_t candidateIndex = 0, count = _allProfiles.Size() + 1; candidateIndex < count; ++candidateIndex)
@@ -275,7 +275,7 @@ Model::Profile CascadiaSettings::DuplicateProfile(const Model::Profile& source)
             break;
         }
         // There is a theoretical unsigned integer wraparound, which is OK
-        newName = fmt::format(L"{} ({} {})", source.Name(), RS_(L"CopySuffix"), candidateIndex + 2);
+        newName = fmt::format(FMT_COMPILE(L"{} ({} {})"), source.Name(), RS_(L"CopySuffix"), candidateIndex + 2);
     }
 
     const auto duplicated = _createNewProfile(newName);
diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
index 237b687964e..ab9706cb4b6 100644
--- a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
+++ b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
@@ -553,12 +553,12 @@ void SettingsLoader::_rethrowSerializationExceptionWithLocationInfo(const JsonUt
     const auto [line, column] = _lineAndColumnFromPosition(settingsString, static_cast<size_t>(e.jsonValue.getOffsetStart()));
 
     fmt::memory_buffer msg;
-    fmt::format_to(msg, "* Line {}, Column {}", line, column);
+    fmt::format_to(std::back_inserter(msg), "* Line {}, Column {}", line, column);
     if (e.key)
     {
-        fmt::format_to(msg, " ({})", *e.key);
+        fmt::format_to(std::back_inserter(msg), " ({})", *e.key);
     }
-    fmt::format_to(msg, "\n  Have: {}\n  Expected: {}\0", jsonValueAsString, e.expectedType);
+    fmt::format_to(std::back_inserter(msg), "\n  Have: {}\n  Expected: {}\0", jsonValueAsString, e.expectedType);
 
     throw SettingsTypedDeserializationException{ msg.data() };
 }
@@ -1243,7 +1243,7 @@ winrt::hstring CascadiaSettings::_calculateHash(std::string_view settings, const
 {
     const auto fileHash = til::hash(settings);
     const ULARGE_INTEGER fileTime{ lastWriteTime.dwLowDateTime, lastWriteTime.dwHighDateTime };
-    const auto hash = fmt::format(L"{:016x}-{:016x}", fileHash, fileTime.QuadPart);
+    const auto hash = fmt::format(FMT_COMPILE(L"{:016x}-{:016x}"), fileHash, fileTime.QuadPart);
     return winrt::hstring{ hash };
 }
 
diff --git a/src/cascadia/TerminalSettingsModel/Command.cpp b/src/cascadia/TerminalSettingsModel/Command.cpp
index ac66d188b9d..730d8834636 100644
--- a/src/cascadia/TerminalSettingsModel/Command.cpp
+++ b/src/cascadia/TerminalSettingsModel/Command.cpp
@@ -727,7 +727,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
                 continue;
             }
             auto args = winrt::make_self<SendInputArgs>(
-                winrt::hstring{ fmt::format(L"{}{}{}", cdText, backspaces, line) });
+                winrt::hstring{ fmt::format(FMT_COMPILE(L"{}{}{}"), cdText, backspaces, line) });
 
             Model::ActionAndArgs actionAndArgs{ ShortcutAction::SendInput, *args };
 
diff --git a/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp b/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
index 754ed7cbd82..6a6b903c6f8 100644
--- a/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
+++ b/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
@@ -37,9 +37,7 @@ winrt::hstring DefaultTerminal::Version() const
         return winrt::hstring{};
     }
 
-    fmt::wmemory_buffer buffer;
-    fmt::format_to(buffer, L"{}.{}.{}.{}", version.major, version.minor, version.build, version.revision);
-    return winrt::hstring{ buffer.data(), gsl::narrow_cast<winrt::hstring::size_type>(buffer.size()) };
+    return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}.{}.{}.{}"), version.major, version.minor, version.build, version.revision) };
 }
 
 winrt::hstring DefaultTerminal::Author() const
diff --git a/src/cascadia/TerminalSettingsModel/DefaultTerminal.h b/src/cascadia/TerminalSettingsModel/DefaultTerminal.h
index f8cebcafdef..6aabae137d6 100644
--- a/src/cascadia/TerminalSettingsModel/DefaultTerminal.h
+++ b/src/cascadia/TerminalSettingsModel/DefaultTerminal.h
@@ -30,7 +30,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
 
         hstring ToString()
         {
-            return hstring{ fmt::format(L"{}, {}, {}", Name(), Author(), Version()) };
+            return hstring{ fmt::format(FMT_COMPILE(L"{}, {}, {}"), Name(), Author(), Version()) };
         }
 
         hstring Name() const;
diff --git a/src/cascadia/WinRTUtils/inc/LibraryResources.h b/src/cascadia/WinRTUtils/inc/LibraryResources.h
index 2c6f4de1aaf..56a0b1b5e1b 100644
--- a/src/cascadia/WinRTUtils/inc/LibraryResources.h
+++ b/src/cascadia/WinRTUtils/inc/LibraryResources.h
@@ -69,3 +69,12 @@ namespace Microsoft::Console::Utils
 
 winrt::hstring GetLibraryResourceString(const std::wstring_view key);
 bool HasLibraryResourceWithName(const std::wstring_view key);
+
+#define RS_fmt(x, ...) RS_fmt_impl(USES_RESOURCE(x), __VA_ARGS__)
+
+template<typename... Args>
+std::wstring RS_fmt_impl(std::wstring_view key, Args&&... args)
+{
+    const auto format = GetLibraryResourceString(key);
+    return fmt::format(fmt::runtime(std::wstring_view{ format }), std::forward<Args>(args)...);
+}
diff --git a/src/cascadia/WinRTUtils/inc/WtExeUtils.h b/src/cascadia/WinRTUtils/inc/WtExeUtils.h
index 306af685e1f..eddda66d09c 100644
--- a/src/cascadia/WinRTUtils/inc/WtExeUtils.h
+++ b/src/cascadia/WinRTUtils/inc/WtExeUtils.h
@@ -109,7 +109,7 @@ _TIL_INLINEPREFIX const std::wstring& GetWtExePath()
 // Method Description:
 // - Quotes and escapes the given string so that it can be used as a command-line arg.
 // - e.g. given `\";foo\` will return `"\\\"\;foo\\"` so that the caller can construct a command-line
-//   using something such as `fmt::format(L"wt --title {}", QuoteAndQuoteAndEscapeCommandlineArg(TabTitle()))`.
+//   using something such as `fmt::format(FMT_COMPILE(L"wt --title {}"), QuoteAndQuoteAndEscapeCommandlineArg(TabTitle()))`.
 // Arguments:
 // - arg - the command-line argument to quote and escape.
 // Return Value:
diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp
index bdf4fbfd53a..6ecd065f460 100644
--- a/src/cascadia/WindowsTerminal/AppHost.cpp
+++ b/src/cascadia/WindowsTerminal/AppHost.cpp
@@ -239,7 +239,7 @@ void AppHost::_HandleSessionRestore(const bool startedForContent)
         // Create new windows for each of the other saved layouts.
         for (const auto size = layouts.Size(); startIdx < size; startIdx += 1)
         {
-            auto newWindowArgs = fmt::format(L"{0} -w new -s {1}", args.Commandline()[0], startIdx);
+            auto newWindowArgs = fmt::format(FMT_COMPILE(L"{} -w new -s {}"), args.Commandline()[0], startIdx);
 
             STARTUPINFO si;
             memset(&si, 0, sizeof(si));
diff --git a/src/cascadia/WindowsTerminal/WindowEmperor.cpp b/src/cascadia/WindowsTerminal/WindowEmperor.cpp
index 1e78e721fd4..0891cf451a6 100644
--- a/src/cascadia/WindowsTerminal/WindowEmperor.cpp
+++ b/src/cascadia/WindowsTerminal/WindowEmperor.cpp
@@ -595,7 +595,7 @@ static winrt::fire_and_forget _createNewTerminalWindow(Settings::Model::GlobalSu
     // If we weren't given a name, then just use new to force the window to be
     // unnamed.
     winrt::hstring cmdline{
-        fmt::format(L"-w {}",
+        fmt::format(FMT_COMPILE(L"-w {}"),
                     args.Name().empty() ? L"new" :
                                           args.Name())
     };
diff --git a/src/cascadia/inc/cppwinrt_utils.h b/src/cascadia/inc/cppwinrt_utils.h
index fa1575d32ae..0f35d6eefc4 100644
--- a/src/cascadia/inc/cppwinrt_utils.h
+++ b/src/cascadia/inc/cppwinrt_utils.h
@@ -20,7 +20,7 @@ Revision History:
 template<>
 struct fmt::formatter<winrt::hstring, wchar_t> : fmt::formatter<fmt::wstring_view, wchar_t>
 {
-    auto format(const winrt::hstring& str, auto& ctx)
+    auto format(const winrt::hstring& str, auto& ctx) const
     {
         return fmt::formatter<fmt::wstring_view, wchar_t>::format({ str.data(), str.size() }, ctx);
     }
diff --git a/src/inc/LibraryIncludes.h b/src/inc/LibraryIncludes.h
index 41b74ccab93..a80e351ffeb 100644
--- a/src/inc/LibraryIncludes.h
+++ b/src/inc/LibraryIncludes.h
@@ -83,8 +83,11 @@
 #include <intsafe.h>
 
 // {fmt}, a C++20-compatible formatting library
-#include <fmt/format.h>
+#pragma warning(push)
+#pragma warning(disable: 4702) // unreachable code
 #include <fmt/compile.h>
+#include <fmt/xchar.h>
+#pragma warning(pop)
 
 #define USE_INTERVAL_TREE_NAMESPACE
 #include <IntervalTree.h>
diff --git a/src/renderer/atlas/pch.h b/src/renderer/atlas/pch.h
index f06a26c4946..240af13275b 100644
--- a/src/renderer/atlas/pch.h
+++ b/src/renderer/atlas/pch.h
@@ -6,16 +6,12 @@
 #define NOMINMAX
 #define WIN32_LEAN_AND_MEAN
 
-#include <array>
 #include <filesystem>
+#include <functional>
 #include <optional>
 #include <shared_mutex>
 #include <span>
-#include <sstream>
 #include <string_view>
-#include <thread>
-#include <unordered_map>
-#include <unordered_set>
 #include <vector>
 
 #include <d2d1_3.h>
@@ -32,9 +28,7 @@
 #include <gsl/pointers>
 #include <wil/com.h>
 #include <wil/filesystem.h>
-#include <wil/result_macros.h>
 #include <wil/stl.h>
-#include <wil/win32_helpers.h>
 
 // Chromium Numerics (safe math)
 #pragma warning(push)
@@ -44,8 +38,10 @@
 #pragma warning(pop)
 
 // {fmt}, a C++20-compatible formatting library
-#include <fmt/format.h>
+#pragma warning(push)
+#pragma warning(disable : 4702) // unreachable code
 #include <fmt/compile.h>
+#include <fmt/xchar.h>
+#pragma warning(pop)
 
 #include <til.h>
-#include <til/bit.h>
diff --git a/src/terminal/adapter/DispatchTypes.hpp b/src/terminal/adapter/DispatchTypes.hpp
index cb8adee0151..4db898d1a83 100644
--- a/src/terminal/adapter/DispatchTypes.hpp
+++ b/src/terminal/adapter/DispatchTypes.hpp
@@ -28,7 +28,7 @@ namespace Microsoft::Console::VirtualTerminal
             return _value;
         }
 
-        constexpr const std::string_view ToString() const
+        constexpr const char* ToString() const
         {
             return &_string[0];
         }
@@ -693,3 +693,31 @@ namespace Microsoft::Console::VirtualTerminal::DispatchTypes
     constexpr VTInt s_sDECCOLMResetColumns = 80;
 
 }
+
+#pragma warning(push)
+#pragma warning(disable : 26429) // Symbol 'in' is never tested for nullness, it can be marked as not_null (f.23).
+#pragma warning(disable : 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
+
+template<typename Char>
+struct fmt::formatter<Microsoft::Console::VirtualTerminal::VTID, Char>
+{
+    constexpr auto parse(auto& ctx)
+    {
+        return ctx.begin();
+    }
+
+    constexpr auto format(const Microsoft::Console::VirtualTerminal::VTID& p, auto& ctx) const
+    {
+        auto in = p.ToString();
+        auto out = ctx.out();
+
+        for (; *in; ++in, ++out)
+        {
+            *out = *in;
+        }
+
+        return out;
+    }
+};
+
+#pragma warning(pop)
diff --git a/src/terminal/adapter/adaptDispatch.cpp b/src/terminal/adapter/adaptDispatch.cpp
index 68cd77bfc47..7569bfa1c7c 100644
--- a/src/terminal/adapter/adaptDispatch.cpp
+++ b/src/terminal/adapter/adaptDispatch.cpp
@@ -4065,7 +4065,7 @@ bool AdaptDispatch::RequestUserPreferenceCharset()
 {
     const auto size = _termOutput.GetUserPreferenceCharsetSize();
     const auto id = _termOutput.GetUserPreferenceCharsetId();
-    _api.ReturnResponse(fmt::format(FMT_COMPILE(L"\033P{}!u{}\033\\"), (size == 96 ? 1 : 0), id.ToString()));
+    _api.ReturnResponse(fmt::format(FMT_COMPILE(L"\033P{}!u{}\033\\"), (size == 96 ? 1 : 0), id));
     return true;
 }
 
@@ -4621,10 +4621,10 @@ void AdaptDispatch::_ReportCursorInformation()
         leftSetNumber,
         rightSetNumber,
         charsetSizes,
-        charset0.ToString(),
-        charset1.ToString(),
-        charset2.ToString(),
-        charset3.ToString());
+        charset0,
+        charset1,
+        charset2,
+        charset3);
     _api.ReturnResponse({ response.data(), response.size() });
 }
 
diff --git a/src/types/UiaTracing.cpp b/src/types/UiaTracing.cpp
index 80bc99d1668..cc31b273e64 100644
--- a/src/types/UiaTracing.cpp
+++ b/src/types/UiaTracing.cpp
@@ -663,7 +663,7 @@ void UiaTracing::TextProvider::RangeFromPoint(const ScreenInfoUiaProviderBase& s
     if (TraceLoggingProviderEnabled(g_UiaProviderTraceProvider, WINEVENT_LEVEL_VERBOSE, TIL_KEYWORD_TRACE))
     {
         static constexpr auto getPoint = [](const UiaPoint& point) {
-            return fmt::format(FMT_COMPILE(L"{},{}"), (float)point.x, (float)point.y);
+            return fmt::format(FMT_COMPILE(L"{},{}"), (int)point.x, (int)point.y);
         };
 
         TraceLoggingWrite(
diff --git a/src/types/utils.cpp b/src/types/utils.cpp
index 1c65c2f889e..0d099f7ad28 100644
--- a/src/types/utils.cpp
+++ b/src/types/utils.cpp
@@ -959,7 +959,7 @@ std::tuple<std::wstring, std::wstring> Utils::MangleStartingDirectoryForWSL(std:
                         break; // just bail out.
                     }
 
-                    if (!til::equals_insensitive_ascii(executablePath.parent_path().c_str(), systemDirectory))
+                    if (!til::equals_insensitive_ascii(executablePath.parent_path().native(), systemDirectory))
                     {
                         break; // it wasn't in system32!
                     }
diff --git a/vcpkg.json b/vcpkg.json
index 23b33e9de69..bd610a805e4 100644
--- a/vcpkg.json
+++ b/vcpkg.json
@@ -16,7 +16,7 @@
   "overrides": [
     {
       "name": "fmt",
-      "version": "7.1.3"
+      "version": "11.0.2"
     },
     {
       "name": "ms-gsl",
@@ -31,5 +31,5 @@
       "version": "2.4.2"
     }
   ],
-  "builtin-baseline": "2fd62b5d878104f4092af80533923bfe2bba2ee0"
+  "builtin-baseline": "fe1cde61e971d53c9687cf9a46308f8f55da19fa"
 }


Test patch: