> RobRelyea.com > Tools > XamlMigrate

XamlMigrate

XamlMigrate is a tool to help convert xmlns uris in WPF XAML to the new xmlns uris in the Feb 2006 CTP.

To report problems please add comments to blog posts listed below or contact me.
 

Feb CTP Changes

This tool will help upgrade your WPF XAML files to the Feb CTP.  It doesn't do an exhaustive upgrade, but it does handle the following major changes:

  • Change all xmlns uris of http://schemas.microsoft.com/winfx/avalon/2005 to http://schemas.microsoft.com/winfx/2006/xaml/presentation
  • Change all xmlns uris of http://schemas.microsoft.com/winfx/xaml/2005 to http://schemas.microsoft.com/winfx/2006/xaml
  • Replaces all mapping PIs with the new clr-namespace uri syntax:
    • Old Syntax 1
      • <?Mapping ClrNamespace="MyNS" XmlNamespace="other" Assembly="MyAssembly" ?>
      • <Page ... xmlns:foo="other">
    • Replacement Syntax 1
      • <Page ... xmlns:foo="clr-namespace:MyNS;assembly=MyAssembly">
    • Old Syntax 2
      • <?Mapping ClrNamespace="MyNS" XmlNamespace="local" ?>
      • <Page ... xmlns:foo="local">
    • Replacement Syntax 2
      • <Page ... xmlns:foo="clr-namespace:MyNS">
  • Ensure all RowDefintion and ColumnDefinition elements are not direct children of Grid.  They must be in a Grid.RowDefinitions or Grid.ColumnDefinitions property element.

Instructions
Unzip, place XamlMigrate.exe in a tools directory that is part of your path.
Change to the directory where your xaml files live and follow the instructions below.

Instructions from command line
============================================================================
XamlMigrate [/s] /mode:[overwrite|tempfile] filepattern1 filepattern2 ... filepatternN
/s - process any files matching filepattern1...n in all subdirectories
/mode:overwrite - overwrite changed files. backs up original files to *.bak
/mode:tempfile - create a *.temp file if changes are required.
filepattern - a filename or a filename with wildcards (?, *) in it.

============================================================================
To begin your conversion process:
============================================================================
1) PLEASE BACKUP ALL XAML FILES BEFORE MIGRATING!!!
2) run the following on some of your files
XamlMigrate *.xaml /mode:tempfile
3) inspect the *.temp files created.
4) if things look good, run it in overwrite mode.
XamlMigrate *.xaml /mode:overwrite
5) the original files will be copied to *.bak before modification
6) There is a /s switch to run recursively on subdirectories

Download it:

Blog Posts About This Tool

Announcement of XamlMigrate pending availability