Skip to content

Commit 68b083d

Browse files
committed
Add workaround to Mile.Project.Cpp.targets for solving the App.xaml resource not found issue if users want to put App.xaml to dynamic library project instead of application project.
1 parent c00a542 commit 68b083d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Mile.Project.Cpp.targets

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,31 @@
1515
<ResourceCompile Condition="'$(MileProjectUseProjectProperties)' == 'true'" Include="$(MSBuildThisFileDirectory)Mile.Project.Version.rc" />
1616
</ItemGroup>
1717
</Target>
18+
<!-- ## BEGIN HACK - Place App.xbf at root of PRI resource tree ## -->
19+
<!--
20+
Reference: https://github.com/microsoft/terminal
21+
/blob/e80aadd98ba2a461cc5063dac1895b5f535dcff2
22+
/src/cascadia/TerminalApp/TerminalAppLib.vcxproj#L499
23+
-->
24+
<!--
25+
By default, the PRI file will contain resource paths beginning with the
26+
project name. Since we enabled XBF embedding, this *also* includes App.xbf.
27+
Well, App.xbf is hard-coded by the framework to be found at the resource
28+
ROOT. To make that happen, we have to disable the prepending of the project
29+
name to the App xaml files.
30+
-->
31+
<PropertyGroup>
32+
<_GenerateProjectPriFileDependsOn>MileProjectPlaceAppXbfAtRootOfResourceTree;$(_GenerateProjectPriFileDependsOn)</_GenerateProjectPriFileDependsOn>
33+
</PropertyGroup>
34+
<Target Name="MileProjectPlaceAppXbfAtRootOfResourceTree" DependsOnTargets="GetPackagingOutputs">
35+
<ItemGroup>
36+
<_RelocatedAppXamlData Include="@(PackagingOutputs)" Condition="'%(Filename)' == 'App' and ('%(Extension)' == '.xaml' or '%(Extension)' == '.xbf')" />
37+
<PackagingOutputs Remove="@(_RelocatedAppXamlData)" />
38+
<PackagingOutputs Include="@(_RelocatedAppXamlData)">
39+
<TargetPath>%(Filename)%(Extension)</TargetPath>
40+
</PackagingOutputs>
41+
</ItemGroup>
42+
</Target>
43+
<!-- ## END HACK - Place App.xbf at root of PRI resource tree ## -->
1844
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
1945
</Project>

0 commit comments

Comments
 (0)