Uno.XamlMerge.Task 0.1.0-dev.48

Prefix Reserved
This is a prerelease version of Uno.XamlMerge.Task.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Uno.XamlMerge.Task --version 0.1.0-dev.48
                    
NuGet\Install-Package Uno.XamlMerge.Task -Version 0.1.0-dev.48
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Uno.XamlMerge.Task" Version="0.1.0-dev.48" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Uno.XamlMerge.Task" Version="0.1.0-dev.48" />
                    
Directory.Packages.props
<PackageReference Include="Uno.XamlMerge.Task" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Uno.XamlMerge.Task --version 0.1.0-dev.48
                    
#r "nuget: Uno.XamlMerge.Task, 0.1.0-dev.48"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Uno.XamlMerge.Task@0.1.0-dev.48
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Uno.XamlMerge.Task&version=0.1.0-dev.48&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Uno.XamlMerge.Task&version=0.1.0-dev.48&prerelease
                    
Install as a Cake Tool

Uno.XamlMerge.Task

An msbuild task which enables the merging of WinUI XAML resource dictionaries into a single flat ResourceDictionary.

This code is derived from WinUI's BatchMergeXaml class, to be reused in any WinUI and Uno Platform Controls library.

Why merge ResourceDictionary instances ?

This task is generally used to allow for separate resource dictionary authoring (which makes them easier to load and read) to avoid impacting resources lookup runtime performance. In WinUI, ResourceDictionary resolution is performed through a graph traversal of MergedDictionaries, which generally implies that a worse case resolution can require as many lookups as there are dictionaries.

To limit the impact of the traversal, this task task takes all resource dictionaries found in a specific MSBuild item group, and merges them into a single file. This file is then generally either named Themes\Generic.xaml or referenced as a merged dictionary from another Themes\Generic.xaml file.

Using the task

Include the following block:

<PropertyGroup>
    <_Uno_XamlMerge_Task_Version>1.0.0</_Uno_XamlMerge_Task_Version>
</PropertyGroup>
<ItemGroup>
    <PackageReference Include="Uno.XamlMerge.Task" Version="$(_Uno_XamlMerge_Task_Version)" />
</ItemGroup>

Then select the resource dictionaries to be merged:

<ItemGroup>
    <XamlMergeInput Include="Styles\**\*.xaml" />
</ItemGroup>

Then add the following block at the end your project library or app:

<Import Project="$(NuGetPackageRoot)uno.xamlmerge.task\$(_Uno_XamlMerge_Task_Version)\build\Uno.XamlMerge.Task.targets"
        Condition="'$(TargetFramework)' == '' and '$(TargetFrameworks)'!='' and exists('$(NuGetPackageRoot)\uno.xamlmerge.task\$(_Uno_XamlMerge_Task_Version)')" />

The generated file is called Generated\mergedpages.xaml by default, but can be overriden as follows:

<PropertyGroup>
    <XamlMergeOutputFile>Themes\Generic.xaml</XamlMergeOutputFile>
</PropertyGroup>

Otherwise, the generated file can be referenced as follows:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TestLibrary">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="ms-appx:///REPLACE_ME/Generated/mergedpages.xaml" />
	</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Uno.XamlMerge.Task:

Package Downloads
Nventive.View.Uno

Nventive.View.Uno

Nventive.View.Uno.WinUI

Nventive.View.Uno.WinUI

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Uno.XamlMerge.Task:

Repository Stars
unoplatform/uno
Open-source platform for building cross-platform native Mobile, Web, Desktop, and Embedded apps from a single C#/XAML codebase. Work from any IDE/CLI with Hot Reload, Visual Designer, MCPs, and Skills built for modern .NET workflows. 200M+ NuGet downloads.
unoplatform/Uno.Themes
This library is designed to help you use the Material, Fluent or Cupertino design system with the Uno Platform
unoplatform/uno.toolkit.ui
A set of custom controls for the WinUI and the Uno Platform not offered out of the box by WinUI, such as Card, TabBar, NavigationBar, etc.
Version Downloads Last Updated
1.34.0-dev.3 8,443 11/21/2024
1.33.1 66,078 11/21/2024
1.33.0-dev.2 144 11/21/2024
1.32.0-dev.61 90,093 12/5/2023
1.31.0-dev.59 182 11/8/2023
1.30.0-dev.54 170 11/8/2023
1.29.0-dev.52 160 11/8/2023
1.28.0-dev.46 168 11/8/2023
1.27.0-dev.44 339,848 7/21/2023
1.26.0-dev.40 102,700 2/17/2023
1.25.0-dev.38 300 2/17/2023
1.24.0-dev.34 259 2/15/2023
1.23.0-dev.24 329 2/8/2023
1.22.0-dev.22 2,123 1/12/2023
1.21.0-dev.21 305 12/19/2022
1.20.0-dev.20 239 12/19/2022
1.19.0-dev.19 250 12/19/2022
1.4.0-dev.8 138 11/21/2024
1.4.0-dev.7 126 11/20/2024
0.1.0-dev.48 3,020 1/10/2022
Loading failed

#  (2022-01-10)


### Bug Fixes

* Add support for merging files in heads ([#17](https://github.com/unoplatform/uno.xamlmerge.task/issues/17)) ([ddaeb6b](https://github.com/unoplatform/uno.xamlmerge.task/commit/ddaeb6b59f520f8886ffbb19ee01241c30a6d9f5))
* Adjust for invalid exclusion for styles in namespaces ([#15](https://github.com/unoplatform/uno.xamlmerge.task/issues/15)) ([12346f6](https://github.com/unoplatform/uno.xamlmerge.task/commit/12346f65aeaf78f7110300308bc9eebdd2899491))
* Adjust support for multi-targeting ([#16](https://github.com/unoplatform/uno.xamlmerge.task/issues/16)) ([a78dae5](https://github.com/unoplatform/uno.xamlmerge.task/commit/a78dae5d5ae621617d0d84a04c96a25efd3e18d7))
* append merged dictionaries at the top of the file ([d09f225](https://github.com/unoplatform/uno.xamlmerge.task/commit/d09f2252001332ab747e9f838f5b9b6493f123b3))
* Disable .NET Native for test app ([21eba73](https://github.com/unoplatform/uno.xamlmerge.task/commit/21eba73604e15c9e46a1e3dd32825e9ca430859d))
* Disable signing when key is not present ([c241fd8](https://github.com/unoplatform/uno.xamlmerge.task/commit/c241fd83656c68fa1799acac027d004ec7d821b7))
* Disable unused UWP validations ([96bb4cf](https://github.com/unoplatform/uno.xamlmerge.task/commit/96bb4cf9debd476599225489f3140da8086cfdba))
* Generate shadow binary to avoid build errors ([316dbde](https://github.com/unoplatform/uno.xamlmerge.task/commit/316dbdecbd7105db7d47c64b7b52f94b272871f6))
* Remove comments ([6be0abd](https://github.com/unoplatform/uno.xamlmerge.task/commit/6be0abd75f5a09acd29af9a559fed8f7f0b425f5))
* support for empty root node ([#11](https://github.com/unoplatform/uno.xamlmerge.task/issues/11)) ([b8e23f9](https://github.com/unoplatform/uno.xamlmerge.task/commit/b8e23f9965f1d4c33f30c40d65512de2bb2d6694))


### Features

* Add support for duplicate keys in different namespaces ([#14](https://github.com/unoplatform/uno.xamlmerge.task/issues/14)) ([acdaef4](https://github.com/unoplatform/uno.xamlmerge.task/commit/acdaef4c90547259cfb3b197331a0478f5fe362f))
* Include xaml file source in merged file ([#13](https://github.com/unoplatform/uno.xamlmerge.task/issues/13)) ([f8988a6](https://github.com/unoplatform/uno.xamlmerge.task/commit/f8988a67c9bc0dc5e7defab84542df486e4d1b29))