Skip to content

Commit

Permalink
Fix assets bundling for UWP/WinUI packages (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsko authored and davidxuang committed Oct 28, 2024
1 parent 097ea87 commit 5d2e2ff
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 34 deletions.
22 changes: 5 additions & 17 deletions FluentIcons.Uwp/FluentIcons.Uwp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
<IsPackable>true</IsPackable>
<IsPublishable>true</IsPublishable>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludeAssetsInNuGetPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<Choose>
<When Condition="$(TargetFramework.StartsWith('uap'))">
<PropertyGroup>
<UseUWP>true</UseUWP>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
Expand Down Expand Up @@ -47,21 +45,11 @@
</ItemGroup>

<ItemGroup>
<None Include="build\**" Pack="true" PackagePath="build;buildTransitive" />
<None
Include="..\seagull-icons\assets\FluentSystemIcons.ttf;..\seagull-icons\assets\SeagullFluentIcons.ttf"
Pack="true"
PackagePath="content-transitive/$(PackageId)/Assets" />
<None Include="VisualStudioToolsManifest.xml" Pack="True" PackagePath="tools" />
</ItemGroup>

<Target Name="IncludeAssetsInNuGetPackage" Condition="'$(IncludeBuildOutput)' != 'false'" DependsOnTargets="GetNuGetShortFolderName">
<ItemGroup Condition="$(TargetFramework.StartsWith('uap'))">
<TfmSpecificPackageFile Include="../seagull-icons/assets/FluentSystemIcons.ttf">
<Link>$(PackageId)/Assets/FluentSystemIcons.ttf</Link>
<PackagePath>contentFiles/any/$(NuGetTargetFrameworkFolderName)/%(Link)</PackagePath>
<BuildAction>Content</BuildAction>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="../seagull-icons/assets/SeagullFluentIcons.ttf">
<Link>$(PackageId)/Assets/SeagullFluentIcons.ttf</Link>
<PackagePath>contentFiles/any/$(NuGetTargetFrameworkFolderName)/%(Link)</PackagePath>
<BuildAction>Content</BuildAction>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
</Project>
7 changes: 7 additions & 0 deletions FluentIcons.Uwp/build/uap10.0.17763.0/FluentIcons.Uwp.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<ItemGroup Condition="'$(OutputType)' == 'AppContainerExe'">
<Content Include="$(MSBuildThisFileDirectory)..\..\content-transitive\**" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions FluentIcons.Uwp/build/uap10.0.17763.0/FluentIcons.Uwp.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
22 changes: 7 additions & 15 deletions FluentIcons.WinUI/FluentIcons.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<EnableMsixTooling>true</EnableMsixTooling>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludeAssetsInNuGetPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -45,18 +44,11 @@
<ProjectReference Include="..\FluentIcons.Common\FluentIcons.Common.csproj" ExactVersion="true" />
</ItemGroup>

<Target Name="IncludeAssetsInNuGetPackage" Condition="'$(IncludeBuildOutput)' != 'false'" DependsOnTargets="GetNuGetShortFolderName">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<TfmSpecificPackageFile Include="../seagull-icons/assets/FluentSystemIcons.ttf">
<Link>$(PackageId)/Assets/FluentSystemIcons.ttf</Link>
<PackagePath>contentFiles/any/$(NuGetShortFolderName)/%(Link)</PackagePath>
<BuildAction>Content</BuildAction>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="../seagull-icons/assets/SeagullFluentIcons.ttf">
<Link>$(PackageId)/Assets/SeagullFluentIcons.ttf</Link>
<PackagePath>contentFiles/any/$(NuGetShortFolderName)/%(Link)</PackagePath>
<BuildAction>Content</BuildAction>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
<ItemGroup>
<None Include="build\**" Pack="true" PackagePath="build;buildTransitive" />
<None
Include="..\seagull-icons\assets\FluentSystemIcons.ttf;..\seagull-icons\assets\SeagullFluentIcons.ttf"
Pack="true"
PackagePath="content-transitive/$(PackageId)/Assets" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<ItemGroup Condition="'$(UseWinUI)' == 'true' and '$(OutputType)' == 'WinExe'">
<Content Include="$(MSBuildThisFileDirectory)..\..\content-transitive\**" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<ItemGroup Condition="'$(UseWinUI)' == 'true' and '$(OutputType)' == 'WinExe'">
<Content Include="$(MSBuildThisFileDirectory)..\..\content-transitive\**" Visible="false" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ To enable `UseSegoeMetrics` globally, call `UseSegoeMetric(this AppBuilder build

### UWP / WinUI

⚠️ You must reference this package directly so that fonts can be included in the build output properly. ⚠️

To enable `UseSegoeMetrics` globally, call `UseSegoeMetric(this Application app)` or `UseSegoeMetric(this IHostBuilder builder)` (WinUI-only).

### WPF
Expand Down

0 comments on commit 5d2e2ff

Please sign in to comment.