AvaloniaUI - XAML - Unable to resolve type from namespace
See original GitHub issueHi:
I believe I might have asked this previously, but I can’t seem to find the post or reply, so I’ll repost.
I’ve been working with the DevExpress MVVM assembly (.Net Core). I created a version of the assembly that uses AvaloniaUI in place of WPF.
I’m including this assembly i my client project and am having difficulty with name space resolution in a XAML definition. I’ using the above mentioned MVVM assembly (using AvaloniaUI) in place of the default version.
Consider the following XAML definition:
<Window x:Class="Sample.Views.MainWindowView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:views="clr-namespace:Sample.Views"
xmlns:productionViewModels="clr-namespace:Sample.ViewModels.Production"
xmlns:designViewModels="clr-namespace:Sample.ViewModels.Designer"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d"
Title="Sample" Height="720" Width="1280"
DataContext="{dxmvvm:ViewModelSource Type=productionViewModels:MainWindowViewModel}"
d:DataContext="{dxmvvm:ViewModelSource Type=designViewModels:MainWindowViewModel}">
I get the following error:
Error XAMLIL Unable to resolve type ViewModelSource from namespace http://schemas.devexpress.com/winfx/2008/xaml/mvvm (line 13 position 9) Line 13, position 9.
I recall reading somewhere that I should try using the referenced assembly rather than the URL in the namespace definition. I’m unsure on how to do this.
Can someone help shed some light on this and what steps for resolution would be?
Thanks JohnB
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)

Top Related StackOverflow Question
Any update on this? I’m seeing the same problem, which (occasionally) causes the preview to fail to load.
In my case I just changed the namespaces used across the project, and everything builds and runs just fine.
Edit: In my case it’s solved by changing
xmlns:vm="clr-namespace:some.namespace.ViewModels;assembly=my_assembly"toxmlns:vm="clr-namespace:some.namespace.ViewModelsassembly=my_assemblywas there from the template generated project. Will it cause problems removing it?@camelCaseCo @helmesjo Replacing the underscore with a space did it for me. No need to remove the assembly entirely. Probably best to just not put spaces in the project name in the first place…