Skip to content

Script Integration

David Grochocki edited this page Mar 23, 2017 · 21 revisions

The power of XAML Styler is also wrapped in a small executable that can be integrated into build scripts, git commit templates, and more. Xstyler.exe is built on top of the same styling engine that powers the Visual Studio plugin, and can be configured by specifying an external configuration.

NuGet version

Standalone: XamlStyler.Console-3.0.0.zip

Basic Usage

./xstyler.exe -f "MainPage.xaml" -c "Config.json"
./xstyler.exe -r -d "C:\Solution\" -c "Config.json"

Help

XAML Styler #.#.#.#
Copyright (c) Xavalon 2016

  -f, --file         XAML file to process (supports comma-separated list).

  -d, --directory    Directory to process XAML files in.

  -c, --config       JSON file containing XAML Styler settings configuration.

  -i, --ignore       (Default: False) Ignore XAML file type check and process
                     all files.

  -r, --recursive    (Default: False) Recursively process specified directory.

  -l, --loglevel     (Default: Default) Levels in order of increasing detail:
                     None, Minimal, Default, Verbose, Debug

  --help             Display this help screen.

Note: xstyler.exe cannot detect Visual Studio indentation options (see Indent Size for more information).

Examples

  • PowerShell - Running xstyler.exe from Windows PowerShell.
  • Command Prompt - Running xstyler.exe from Windows Command Prompt.
  • Batch File - Batch process XAML files in your projects.
  • Git Bash - Running xstyler.exe from Git Bash.
  • Git Hook - Integrate with your commit process to ensure XAML files are formatted before getting checked in.

Have a useful recipe? Let us know, and we will add it to the Wiki for others to use in their projects.