Skip to content

Commit

Permalink
Fix build break where Microsoft.Terminal.Control.dll is empty (#9537)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zadjii-msft authored Mar 18, 2021
1 parent acdcdca commit 2ed367f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- ========================= Misc Files ======================== -->
<ItemGroup>
<None Include="packages.config" />
<None Include="Microsoft.Terminal.Remoting.def" />
<None Include="$(ProjectName).def" />
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="WindowsTerminalShellExt.def" />
<None Include="$(ProjectName).def" />
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/dll/TerminalApp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<!-- ========================= Misc Files ======================== -->
<ItemGroup>
<None Include="packages.config" />
<None Include="TerminalApp.def" />
<None Include="$(ProjectName).def" />
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/dll/TerminalControl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<!-- ========================= Misc Files ======================== -->
<ItemGroup>
<None Include="packages.config" />
<None Include="TerminalControl.def" />
<None Include="$(ProjectName).def" />
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
<SubType>Designer</SubType>
</PRIResource>
<OCResourceDirectory Include="Resources" />
<None Include="TerminalSettingsEditor.def" />
<None Include="$(ProjectName).def" />
<None Include="packages.config" />
<None Include="PropertySheet.props" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</Midl>
</ItemGroup>
<ItemGroup>
<None Include="TerminalSettingsEditor.def" />
<None Include="Microsoft.Terminal.Settings.Editor.def" />
<None Include="packages.config" />
<None Include="PropertySheet.props" />
</ItemGroup>
Expand All @@ -41,4 +41,4 @@
<UniqueIdentifier>{00f725c8-41b4-40a8-995e-8ee2e49a4a4c}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<!-- ========================= Misc Files ======================== -->
<ItemGroup>
<None Include="packages.config" />
<None Include="Microsoft.Terminal.Settings.Model.def" />
<None Include="$(ProjectName).def" />
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
Expand Down

0 comments on commit 2ed367f

Please sign in to comment.