PsdUtilities.Wpf.MsBuild
1.1.0
dotnet add package PsdUtilities.Wpf.MsBuild --version 1.1.0
NuGet\Install-Package PsdUtilities.Wpf.MsBuild -Version 1.1.0
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="PsdUtilities.Wpf.MsBuild" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PsdUtilities.Wpf.MsBuild" Version="1.1.0" />
<PackageReference Include="PsdUtilities.Wpf.MsBuild" />
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 PsdUtilities.Wpf.MsBuild --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PsdUtilities.Wpf.MsBuild, 1.1.0"
#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 PsdUtilities.Wpf.MsBuild@1.1.0
#: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=PsdUtilities.Wpf.MsBuild&version=1.1.0
#tool nuget:?package=PsdUtilities.Wpf.MsBuild&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PsdUtilities.Wpf.MsBuild
This utility library lets you easily define your resource values to later be generated as a WPF resource dictionary.
Example of XML file Definition
<?xml version="1.0" encoding="utf-8" ?>
<DataValues>
<Colors>
<HexColor Name="ColorRed">#FF0000</HexColor>
<RgbaColor Name="AnotherColorRed">255,0,0</RgbaColor>
<RgbaColor Name="AnotherColorRedWithAlpha">255,0,0,32</RgbaColor>
</Colors>
<Margins>
<Margin>8</Margin>
</Margins>
<FontSizes>
<FontSize>12</FontSize>
</FontSizes>
<Strings>
<String Name="AcceptText">Accept now</String>
<String Name="DescriptionText">
This is some
multi-line description
</String>
</Strings>
</DataValues>
And this generates something like this:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<String
xmlns="clr-namespace:System;assembly=mscorlib"
x:Key="AcceptText"
xml:space="preserve">Accept now</String>
<String
xmlns="clr-namespace:System;assembly=mscorlib"
x:Key="DescriptionText"
xml:space="preserve">
This is some
multi-line description
</String>
<Thickness x:Key="MGN-8">8</Thickness>
<Thickness x:Key="MGN-8-L">8,0,0,0</Thickness>
<Thickness x:Key="MGN-8-T">0,8,0,0</Thickness>
<Thickness x:Key="MGN-8-LT">8,8,0,0</Thickness>
<Thickness x:Key="MGN-8-R">0,0,8,0</Thickness>
<Thickness x:Key="MGN-8-LR">8,0,8,0</Thickness>
<Thickness x:Key="MGN-8-TR">0,8,8,0</Thickness>
<Thickness x:Key="MGN-8-LTR">8,8,8,0</Thickness>
<Thickness x:Key="MGN-8-B">0,0,0,8</Thickness>
<Thickness x:Key="MGN-8-LB">8,0,0,8</Thickness>
<Thickness x:Key="MGN-8-TB">0,8,0,8</Thickness>
<Thickness x:Key="MGN-8-LTB">8,8,0,8</Thickness>
<Thickness x:Key="MGN-8-RB">0,0,8,8</Thickness>
<Thickness x:Key="MGN-8-LRB">8,0,8,8</Thickness>
<Thickness x:Key="MGN-8-TRB">0,8,8,8</Thickness>
<Thickness x:Key="MGN-8-LTRB">8,8,8,8</Thickness>
<Double xmlns="clr-namespace:System;assembly=mscorlib" x:Key="FNT-12">12</Double>
<Color x:Key="ColorRed">#FF0000</Color>
<SolidColorBrush x:Key="ColorRedBrush" Color="{StaticResource ColorRed}" />
<Color x:Key="AnotherColorRed">#FFFF0000</Color>
<SolidColorBrush x:Key="AnotherColorRedBrush" Color="{StaticResource AnotherColorRed}" />
<Color x:Key="AnotherColorRedWithAlpha">#20FF0000</Color>
<SolidColorBrush x:Key="AnotherColorRedWithAlphaBrush" Color="{StaticResource AnotherColorRedWithAlpha}" />
</ResourceDictionary>
Feature List
- Generating Strings
- Generating Margins:
Thicknessobject that can be used for bothMarginandPaddingproperties - Generating FontSizes: Regular
doublevalue that can be used in multiple places, but prefixes make it more expressive - Generating Colors: a
Colorand aSolidColorBrushobjects for various places and animations
How to setup in Your Project
- Install the nuget package in your project
- Open your
.csprojfile and utilize this code:
<ItemGroup>
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>Global</OptionsType>
<InputFilePath>YourInputFile.xml</InputFilePath>
<OutputFilePath>OutputFile.g.xaml</OutputFilePath>
</WpfUtilityTaskOptions>
</ItemGroup>
<UsingTask AssemblyFile="$(TargetDir)\PsdUtilities.Wpf.MsBuild.dll" TaskFactory="TaskHostFactory" TaskName="WpfUtilityTask" />
<Target Name="WpfUtilityTaskRun" BeforeTargets="Build">
<WpfUtilityTask Parameters="@(WpfUtilityTaskOptions)" />
</Target>
Using this library will require you to have the library compiled alongside your main application. Otherwise, modify the 'AssemblyFile' property in the 'UsingTask' element to the correct destination of the DLL library.
Configuration
For now, there are 4 configuration categories you can modify:
Global Options
Definition in the .csproj:
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>Global</OptionsType>
</WpfUtilityTaskOptions>
Properties:
- [String] InputFilePath: The input data file. Must exist.
- [String] OutputFilePath: The input data file. Gets replaced after each compilation.
Colors Options
Definition in the .csproj:
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>Colors</OptionsType>
</WpfUtilityTaskOptions>
Properties
- [Bool] UseDynamicResource: Whether to use
{DynamicResource ...}over{StaticResource ...}for theSolidColorBrush. - [Bool] ConvertValueToUpperCase: Converts the output
Hexvalue toUPPERCASE. - [Bool] ConvertValueToLowerCase: Converts the output
Hexvalue tolowercase. - [String] SolidColorBrushNameTemplate: The
x:Keytemplate for theSolidColorBrush. Default value is{Color}Brush.{Color}is a required content. - [String] NamePrefix: Prefix for the color name. Empty by default. (Use example: <NamePrefix>CLR-</NamePrefix>. Output: CLR-MyColor)
Margins Options
Definition in the .csproj:
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>Margins</OptionsType>
</WpfUtilityTaskOptions>
Properties
- [String] NamePrefix: Prefix for the margin name.
MGN-by default.
FontSizes Options
Definition in the .csproj:
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>FontSizes</OptionsType>
</WpfUtilityTaskOptions>
Properties
- [String] NamePrefix: Prefix for the margin name.
FNT-by default.
Strings Options
Definition in the .csproj:
<WpfUtilityTaskOptions Include="WpfUtilityTaskOptions">
<OptionsType>FontSizes</OptionsType>
</WpfUtilityTaskOptions>
Properties
- [String] NamePrefix: Prefix for the margin name. Empty by default.
Nuget
| Product | Versions 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
- Microsoft.Build.Framework (>= 18.0.2)
- Microsoft.Build.Utilities.Core (>= 18.0.2)
- System.Memory (>= 4.6.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 180 | 11/24/2025 |