Fix the ut_app build for VS 16.2, 16.3 (#2347)

Move the hack from TerminalApp.vcxproj to a .targets file to be used by the ut_app project too.

Fixes #2143
This commit is contained in:
Mike Griese 2019-08-09 15:21:45 -05:00 committed by Dustin L. Howett (MSFT)
parent eac29d2c67
commit 646d8f91b9
3 changed files with 37 additions and 27 deletions

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This is a terrible, terrible rule. There exists a bug in Visual Studio 2019 16.2 and 16.3 previews
where ResolveAssemblyReferences will try and fail to parse a .lib when it produces a .winmd.
To fix that, we have to _temporarily_ replace the %(Implementation) on any winmd-producing
static library references with the empty string so as to make ResolveAssemblyReferences
not try to read it.
Upstream problem report:
https://developercommunity.visualstudio.com/content/problem/629524/static-library-reference-causes-there-was-a-proble.html
-->
<Target Name="_RemoveTerminalAppLibImplementationFromReference" BeforeTargets="ResolveAssemblyReferences">
<ItemGroup>
<_TerminalAppLibProjectReference Include="@(_ResolvedProjectReferencePaths)" Condition="'%(Filename)' == 'TerminalApp'" />
<_ResolvedProjectReferencePaths Remove="@(_TerminalAppLibProjectReference)" />
<_ResolvedProjectReferencePaths Include="@(_TerminalAppLibProjectReference)">
<Implementation />
</_ResolvedProjectReferencePaths>
</ItemGroup>
</Target>
<Target Name="_RestoreTerminalAppLibImplementationFromReference" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<_ResolvedProjectReferencePaths Remove="@(_TerminalAppLibProjectReference)" />
<_ResolvedProjectReferencePaths Include="@(_TerminalAppLibProjectReference)" />
</ItemGroup>
</Target>
<!-- End "terrible, terrible rule" -->
</Project>

View file

@ -109,32 +109,8 @@
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
<!--
This is a terrible, terrible rule. There exists a bug in Visual Studio 2019 16.2 and 16.3 previews
where ResolveAssemblyReferences will try and fail to parse a .lib when it produces a .winmd.
To fix that, we have to _temporarily_ replace the %(Implementation) on any winmd-producing
static library references with the empty string so as to make ResolveAssemblyReferences
not try to read it.
Upstream problem report:
https://developercommunity.visualstudio.com/content/problem/629524/static-library-reference-causes-there-was-a-proble.html
-->
<Target Name="_RemoveTerminalAppLibImplementationFromReference" BeforeTargets="ResolveAssemblyReferences">
<ItemGroup>
<_TerminalAppLibProjectReference Include="@(_ResolvedProjectReferencePaths)" Condition="'%(Filename)' == 'TerminalApp'" />
<_ResolvedProjectReferencePaths Remove="@(_TerminalAppLibProjectReference)" />
<_ResolvedProjectReferencePaths Include="@(_TerminalAppLibProjectReference)">
<Implementation />
</_ResolvedProjectReferencePaths>
</ItemGroup>
</Target>
<Target Name="_RestoreTerminalAppLibImplementationFromReference" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<_ResolvedProjectReferencePaths Remove="@(_TerminalAppLibProjectReference)" />
<_ResolvedProjectReferencePaths Include="@(_TerminalAppLibProjectReference)" />
</ItemGroup>
</Target>
<!-- End "terrible, terrible rule" -->
<!-- Import this set of targets that fixes a VS bug that manifests when using
the TerminalAppLib project -->
<Import Project="FixVisualStudioBug.targets" />
</Project>

View file

@ -122,4 +122,8 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<!-- Import this set of targets that fixes a VS bug that manifests when using
the TerminalAppLib project -->
<Import Project="../TerminalApp/FixVisualStudioBug.targets" />
</Project>