XAML Spy and Visual Studio Express

Monday, March 10, 2014

XAML Spy is fully integrated with Visual Studio 2012 and 2013. Enabling or disabling XAML Spy for a XAML project is super easy, and the XAML Spy Explorer provides convenient access to your XAML app internals right from within Visual Studio.

Visual Studio Express

That’s all great, but what if you are using Visual Studio Express? The Express products offer Visual Studio for free (which is great), but extensions are not supported. This implies that you cannot use XAML Spy in Visual Studio.

Luckily XAML Spy offers alternative scenarios for connecting your app, where you do not need to have access to your XAML project source. You can select XAP files from disk, attach to running WPF apps, etc. However, support for these scenarios is available only in the full version of XAML Spy. XAML Spy Express (the free edition) requires access to the source code.

Solution

Not all is lost. Although you can’t use XAML Spy in Visual Studio Express, you can use the standalone XAML Spy app with any XAML project created with Visual Studio Express. And it is easy to setup; all that is required is a one-time manual modification of your XAML project file and you are set. Follow the instructions below to enable XAML Spy for your project.

  1. Open your XAML project in Visual Studio Express
  2. Right mouse click the project in the Solution Explorer and select Unload Project.
  3. Right mouse click the project and select Edit [projectname] to open the project in the XML editor.
  4. Scroll all the way down to the end of the file and add the following Import element just before the closing tag as specified below.
<Import
      Project="$(XamlSpyInstallPath)MSBuild\FirstFloor.XamlSpy.Silverlight.targets"
      Condition="'$(XamlSpyInstallPath)' != '' and '$(Configuration)' == 'Debug'" />
  1. Save the project file, right mouse click the project in the Solution Explorer and select Reload Project.

Modifying the project file is a one-time operation. From now on, each time the project is build in Debug mode, XAML Spy is included. When you run your app, it will automatically connect to the XAML Spy service. Use the standalone XAML Spy app to start inspecting your app. To learn more about the XAML Spy Import, see the XAML Spy for Visual Studio documentation.

Conclusion

Visual Studio Express offers a world-class development environment for free. Although extensions are not supported in Visual Studio Express, you can still use XAML Spy outside Visual Studio and easily enable XAML Spy for your XAML projects in Visual Studio Express.

Combine Visual Studio Express with XAML Spy Express, and you get awesome tooling even when you are on a limited budget.