3

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. Reference

My properties of Lib project

Properties of Lib project

However Blend is able to find my ViewModel?

Blend Data Binding

But I can't build, run. I tried cleaning too.

Error Message

Does anybody have a clue what I'm doing wrong?

Thanks in advance

timr
  • 6,668
  • 7
  • 47
  • 79
  • Basic check first: your first capture shows that you've added the `Roadsmart.Lib` project to your solution, but have you properly referenced it? (basically, it is listed if you unfold the references in the `Roadsmart` project?) – Kevin Gosse Feb 19 '15 at 10:51
  • Thanks for your response, it was referenced. See updated screenshot – timr Feb 19 '15 at 10:52

1 Answers1

9

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>
timr
  • 6,668
  • 7
  • 47
  • 79