[PR #9537] [MERGED] Fix build break where Microsoft.Terminal.Control.dll is empty #27620

Open
opened 2026-01-31 09:23:06 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9537
Author: @zadjii-msft
Created: 3/18/2021
Status: Merged
Merged: 3/18/2021
Merged by: @undefined

Base: mainHead: dev/migrie/b/9529-build-break


📝 Commits (3)

  • 3b3c86e I'm committing all this, in case part of it actually is relevant
  • 95a2602 Okay good I didn't need these
  • c6c17d5 Help prevent this from happening again

📊 Changes

8 files changed (+8 additions, -8 deletions)

View changed files

📝 src/cascadia/Remoting/dll/Microsoft.Terminal.Remoting.vcxproj (+1 -1)
📝 src/cascadia/ShellExtension/WindowsTerminalShellExt.vcxproj (+1 -1)
📝 src/cascadia/TerminalApp/dll/TerminalApp.vcxproj (+1 -1)
📝 src/cascadia/TerminalControl/dll/Microsoft.Terminal.Control.def (+0 -0)
📝 src/cascadia/TerminalControl/dll/TerminalControl.vcxproj (+1 -1)
📝 src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj (+1 -1)
📝 src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters (+2 -2)
📝 src/cascadia/TerminalSettingsModel/dll/Microsoft.Terminal.Settings.Model.vcxproj (+1 -1)

📄 Description

TIL that the <None Include="Foo.def" /> line in our projects is
actually totally meaningless. The important line is the one that's in
cppwinrt.build.pre.props, where we declare

<ModuleDefinitionFile Condition="Exists('$(ProjectName).def')">$(ProjectName).def</ModuleDefinitionFile>

So if you change a project's name, and not the .def file, then the
linker will just not use the .def file at all.

More importantly, this seemingly doesn't matter in debug builds. In a
Debug build, the linker will happily still include WINRT_CanUnloadNow
and WINRT_GetActivationFactory in the exports from the dll, even
without the .def. But in a Release build, the linker is much more
agressive about pruning symbols that aren't referenced, and without
those two, NONE of the symbols are eventually referenced.

This PR fixes Microsoft.Terminal.Control by renaming the .def, and
makes it marginally harder for someone to make the same mistake in the
future.

References

PR Checklist


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9537 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 3/18/2021 **Status:** ✅ Merged **Merged:** 3/18/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/9529-build-break` --- ### 📝 Commits (3) - [`3b3c86e`](https://github.com/microsoft/terminal/commit/3b3c86e62fac2a67f675c5b95765c86edfdfd1fe) I'm committing all this, in case part of it actually _is_ relevant - [`95a2602`](https://github.com/microsoft/terminal/commit/95a2602fa274721125eceb28bbfd4c3e9ade9e05) Okay good I didn't need these - [`c6c17d5`](https://github.com/microsoft/terminal/commit/c6c17d5d18bdcb2ffcfbe5fc283849947ca9c901) Help prevent this from happening again ### 📊 Changes **8 files changed** (+8 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/Remoting/dll/Microsoft.Terminal.Remoting.vcxproj` (+1 -1) 📝 `src/cascadia/ShellExtension/WindowsTerminalShellExt.vcxproj` (+1 -1) 📝 `src/cascadia/TerminalApp/dll/TerminalApp.vcxproj` (+1 -1) 📝 `src/cascadia/TerminalControl/dll/Microsoft.Terminal.Control.def` (+0 -0) 📝 `src/cascadia/TerminalControl/dll/TerminalControl.vcxproj` (+1 -1) 📝 `src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj` (+1 -1) 📝 `src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters` (+2 -2) 📝 `src/cascadia/TerminalSettingsModel/dll/Microsoft.Terminal.Settings.Model.vcxproj` (+1 -1) </details> ### 📄 Description TIL that the `<None Include="Foo.def" />` line in our projects is actually totally meaningless. The important line is the one that's in `cppwinrt.build.pre.props`, where we declare ```xml <ModuleDefinitionFile Condition="Exists('$(ProjectName).def')">$(ProjectName).def</ModuleDefinitionFile> ``` So if you change a project's name, and not the `.def` file, then the linker will just _not use the `.def` file at all_. More importantly, this seemingly doesn't matter in debug builds. In a Debug build, the linker will happily still include `WINRT_CanUnloadNow` and `WINRT_GetActivationFactory` in the exports from the dll, even without the `.def`. But in a Release build, the linker is much more agressive about pruning symbols that aren't referenced, and without those two, NONE of the symbols are eventually referenced. This PR fixes `Microsoft.Terminal.Control` by renaming the `.def`, and makes it marginally harder for someone to make the same mistake in the future. ## References * Regressed in #9472 ## PR Checklist * [x] Closes #9529 * [x] I work here --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:23:06 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27620