0

I'm trying to create a ressource in my page of a type defined in another namespace. but on compile, I get an error "Could not load file or assembly 'Hero.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies." What's strange is that intellissence is helping me choose my namespace. The reference is added to my project, I can use the classes in code behind.

Can anyone tell me what's missing? Thanks

Here's my code so far (The last line is giving me the error):

<Page
    x:Name="pageRoot"
    x:Class="Hero.Metro.Home"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Hero.Metro"
    xmlns:VM="using:Hero.ViewModel"
    xmlns:common="using:Hero.Metro.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

        <VM:RacesList x:Key="RacesList"/>
  • Try rebuilding the solution. Intellisense will often find content in other referenced projects that it expects to be in a given DLL, but haven't been actually successfully built yet. – Nate Diamond Jul 19 '13 at 23:00
  • Thanks, I tried that. Clean, Rebuild, Close VS. Clean, Rebuild, I still have the same error. If I do a go to definition on the 'VM:RacesList VS send me to the right place... – Francois Gagnon Jul 19 '13 at 23:58
  • I'm using 2013 Preview. So it might be a bug in the software. But since I'm pretty new to XAML, I'm guessing it's my syntax that is missing something. – Francois Gagnon Jul 20 '13 at 00:00
  • Does your RacesList have a default constructor? Is it in a Portable/Class Library or in the same solution? – Nate Diamond Jul 20 '13 at 00:17
  • It does have a default constructor and it's in a PCL project in the same solution. – Francois Gagnon Jul 20 '13 at 00:23
  • Maybe check somewhere in [here](http://stackoverflow.com/questions/9650778/prism-assembly-reference-failure-system-windows-interactivity)? – Nate Diamond Jul 20 '13 at 05:07
  • Maybe, but I don't understand much of the code. Also, I'm not using Prism but rather the portable class library project built-in. For now I'll do my binding in the code behind but I'll keep the question open in case someone find a way. Thanks again. – Francois Gagnon Jul 20 '13 at 14:35
  • That question actually revolved around the Interactivity PCL, which is one of the reasons I linked it. It may be that the issue with your PCL is the same that they had with the one installed via Nuget. – Nate Diamond Jul 20 '13 at 16:51
  • Here's the real thing to take away: Is your App referencing all of the same DLL's that your PCL is? So, if your PCL is using Mvvm Light, is your App using the same version? – Nate Diamond Jul 20 '13 at 17:25

1 Answers1

0

Replace from

xmlns:VM="using:Hero.ViewModel"

to

xmlns:VM="using:ViewModel"

I had the same problem

demongolem
  • 9,474
  • 36
  • 90
  • 105