Debug and Release Assembly Refrences in XAML

In a XAML namespace declaration, is there a way to disambiguate differently named assemblies depending on your current configuration?

I'm in the process of reworking a projects build system. The old system had the debug and release assemblies building to seperate directories, which meant the following (roughly) would work fine at the top of a XAML document:

<Window x:Class="test.MainWindow"

A request we recieved for the restructure is to differentiate our assemblies by naming them differently for Debug and Release configurations. So our SampleAssembly.dll, which was previously built in two seperate directories, is now two assemblies in the same directory, SampleAssemblyDebug.dll and SampleAssemblyRelease.dll. Is there a way to adjust that XAML line to reference the proper assembly depending on the configuration?


Currently this is not possible, without some nasty precompilation tricks. However what you can do is to define an assembly level attribute XmlnsDefinitionAttribute on your assembly and then use the uri namespace that you have defined in your XAML.

For example in your AssemblyInfo.cs file you can have something like this:

[assembly: XmlnsDefinition("", "TestNameSpace")]

And then in the XAML:


Where MyButton is a type in the TestNameSpace namespace.

Need Your Help

When should one use interfaces?

oop interface

I know that an interface does not have a body just a method definition. But when should I use interfaces? If I provide someone a set of interfaces with no body, why would they feel a need to write ...