XamlPreprocessor 0.1.0

dotnet add package XamlPreprocessor --version 0.1.0                
NuGet\Install-Package XamlPreprocessor -Version 0.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="XamlPreprocessor" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XamlPreprocessor --version 0.1.0                
#r "nuget: XamlPreprocessor, 0.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.
// Install XamlPreprocessor as a Cake Addin
#addin nuget:?package=XamlPreprocessor&version=0.1.0

// Install XamlPreprocessor as a Cake Tool
#tool nuget:?package=XamlPreprocessor&version=0.1.0                

XAML Preprocessor

A NuGet package that enables conditional compilation in XAML files using XML comments, similar to #if preprocessor directives in C# code.

Usage

Add conditional sections in your XAML using XML comments:


<Button Content="This shows when directive is defined"/>



<Button Content="This shows when directive is NOT defined"/>

Define your constants through:

  • Windows command line cmd terminal: set "DefineConstants=%DefineConstants%;directive1;directive2"
  • Or MSBuild command line: /p:DefineConstants="%DefineConstants%;directive1;directive2"
  • Or project .csproj file:
<PropertyGroup>
  <DefineConstants>$(DefineConstants);directive1;directive2</DefineConstants>
</PropertyGroup>

Implementation Details

  • Creates preprocessed XAML copies in the intermediate build directory
  • Preserves original source files
  • Properly handles UTF-8 encoding with BOM for XAML compatibility
  • Integrates seamlessly with WPF's build process
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • 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.0 83 12/9/2024

Initial release