Unknown type 'ViewModelLocator' in XML namespace 'clr-namespace:namespaceblabla;assembly=blabla'

c#, mvvm, viewmodellocator, windows-phone-8, xaml

Solution

Ok, I fixed it by changing the App.xaml to

<Application
    x:Class="Roadsmart.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Roadsmart"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModels="using:Roadsmart.Lib.ViewModels"
    mc:Ignorable="d">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/RoadSmartWindowsPhoneStyle.xaml"/>
                <ResourceDictionary Source="Resources/Dictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <viewModels:ViewModelLocator 
                x:Key="Locator"
                d:IsDataSource="True"/>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Problem

I'm buidling an Windows Phone 8.1 project and I'm using the MVVM Light Libraries only library. I created a PCL project to hold my ViewModels so I can later use them for a Windows Store Project. I followed along the guide http://blog.galasoft.ch/posts/2014/04/building-a-universal-application-for-windows-phone-8-1-and-windows-8-1-with-mvvm-light/ But I'm getting the error in the title? My App.xaml ``` <Application x:Class="Roadsmart.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Roadsmart" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:Roadsmart.Lib.ViewModels;assembly=Roadsmart.Lib" mc:Ignorable="d"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources/RoadSmartWindowsPhoneStyle.xaml"/> <ResourceDictionary Source="Resources/Dictionary.xaml"/> </ResourceDictionary.MergedDictionaries> <viewModels:ViewModelLocator x:Key="Locator" d:IsDataSource="True"/> </ResourceDictionary> </Application.Resources> </Application> ``` I referenced the Roadsmart.Lib in the Windows Phone project. My properties of Lib project However Blend is able to find my ViewModel? But I can't build, run. I tried cleaning too. Does anybody have a clue what I'm doing wrong? Thanks in advance

Original source