XamlToCSharpGenerator.Generator.WPF 0.1.3

dotnet add package XamlToCSharpGenerator.Generator.WPF --version 0.1.3
                    
NuGet\Install-Package XamlToCSharpGenerator.Generator.WPF -Version 0.1.3
                    
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="XamlToCSharpGenerator.Generator.WPF" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XamlToCSharpGenerator.Generator.WPF" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="XamlToCSharpGenerator.Generator.WPF" />
                    
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 XamlToCSharpGenerator.Generator.WPF --version 0.1.3
                    
#r "nuget: XamlToCSharpGenerator.Generator.WPF, 0.1.3"
                    
#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 XamlToCSharpGenerator.Generator.WPF@0.1.3
                    
#: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=XamlToCSharpGenerator.Generator.WPF&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=XamlToCSharpGenerator.Generator.WPF&version=0.1.3
                    
Install as a Cake Tool

XAML Source Generator for WPF (WXSG) Toolset

Become a Sponsor

WXSG replaces WPF's classic XAML/BAML codegen path with Roslyn source generation and emits typed InitializeComponent() code directly in C#.

This toolset is independent and unaffiliated with Microsoft.

This repo's reference usage is: vscode-wpf/sample/net6.0-csharp-expressions.

What You Get

  • Source-generated InitializeComponent() for WPF XAML.
  • Typed x:Name fields in generated partial classes.
  • C# expression support in XAML via {cs: ...}. Preview in .NET MAUI 11.
  • Simpler XAML support (implicit standard namespaces for WXSG parsing). Preview in .NET MAUI 10.

Quick Start (Project Consumption)

Published package page: https://www.nuget.org/packages/XamlToCSharpGenerator.Generator.WPF

  1. Add WXSG package reference:
<ItemGroup>
  <PackageReference Include="XamlToCSharpGenerator.Generator.WPF" Version="0.1.0" PrivateAssets="all" />
</ItemGroup>
  1. Enable WXSG in your .csproj:
<PropertyGroup>
  <UseWPF>true</UseWPF>
  <WpfXsgEnabled>true</WpfXsgEnabled>
</PropertyGroup>

That is enough for normal package usage because the package ships buildTransitive props/targets.

Local Package Development Flow (Optional, Advanced)

When developing WXSG from source (as in vscode-wpf), use a local package feed:

<PropertyGroup>
  <RestoreSources>$(MSBuildProjectDirectory)\..\..\artifacts\local-packages;$(RestoreSources)</RestoreSources>
</PropertyGroup>

Pack locally:

dotnet pack src\XamlToCSharpGenerator.Generator.WPF\XamlToCSharpGenerator.Generator.WPF.csproj -c Debug -o artifacts\local-packages

Then restore/build:

dotnet restore sample\net6.0-csharp-expressions\sample.csproj --no-cache
dotnet build sample\net6.0-csharp-expressions\sample.csproj

XAML Example

From the sample:

<Window xmlns:local="clr-namespace:sample"
        x:Class="sample.MainWindow"
        Title="{cs: string.Concat(&quot;WXSG — &quot;, &quot;C# Expressions + Simpler XAML&quot;)}"
        Width="{cs: 520}"
        Height="{cs: 420}">

  <Window.Resources>
    <local:GreetingViewModel x:Key="Vm" />
  </Window.Resources>

  <Grid DataContext="{StaticResource Vm}" Margin="20">
    <TextBlock x:Name="GreetingLabel" Text="{Binding Greeting}" />
  </Grid>
</Window>

Notes

  • xmlns:local="clr-namespace:YourNamespace" is still needed when referencing your own CLR types (for example view models in Window.Resources), unless you declare an equivalent global prefix.
  • Simpler XAML here means you can omit repeated standard header declarations in WXSG input while still keeping normal WPF semantics.

License

MIT

2026 (c) LeXtudio Inc. All rights reserved.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
0.1.3 81 4/4/2026
0.1.2 86 4/4/2026
0.1.1 76 4/3/2026
0.1.0 82 4/3/2026