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

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

Original Pull Request: https://github.com/microsoft/terminal/pull/9537

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9537 **State:** closed **Merged:** Yes --- 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
claunia added the pull-request label 2026-01-31 09:23:07 +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#27625