Sep 12 2006

WPF UserControls can't be found by the Orcas IDE

Category: IT Related | .Net | ApplicationsRory Primrose @ 06:09

I have created some WPF UserControls, but referencing them in XAML is causing grief in the VS IDE. If I have a UserControl that is in the applications assembly, I set up the namespace mapping with something like the following:

<Page x:Class="XAMLBrowserApplication1.Page1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Page1"
      xmlns:stuff="clr-namespace:XAMLBrowserApplication1.Controls">
    <StackPanel>
        <TextBlock Text="my test" />
        <stuff:UserControl1 />
    </StackPanel>
</Page>

The IDE throws a wobbly saying Assembly '' was not found. The 'clr-namespace' URI refers to an assembly that is not referenced by the project. I haven't specified an assembly because the UserControl is in the same assembly as the XAML. This causes the control <stuff:UserControl1 /> to not be resolved which in turn makes the page invalid. Because the page is invalid, it can't be set as the StartupUri of the application. The application still runs, but I loose designer support.

Just to check, I created a control library project and created a UserControl in the external assembly. I added the control library as a reference to the application and updated the XAML to be the following:

<Page x:Class="XAMLBrowserApplication1.Page1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Page1"
      xmlns:stuff="clr-namespace:CustomControlLibrary1;assembly=CustomControlLibrary1">
    <StackPanel>
        <TextBlock Text="my test" />
        <stuff:UserControl1 />
    </StackPanel>
</Page>

Now the IDE throws a wobbly saying Assembly 'CustomControlLibrary1' was not found. The 'clr-namespace' URI refers to an assembly that is not referenced by the project.

Either this is a bug, or I am a complete nugget. I haven't been able to figure this one out for a few days. Does anyone have any answers for this?

Tags:

Comments (3) -

1.
Rob Relyea Rob Relyea says:

Rory-
Check out this FAQ at: channel9.msdn.com/.../Cider.JuneCTPProjectLimitations

Tool support is not as close to release as the platform.

Sorry,
Rob
Program Manager, WPF Team

2.
Rory Primrose Rory Primrose says:

Thanks Rob. If that FAQ applies to Cider RC1, then it was the third case I didn't think to check. I am using a project reference for the UserControl rather than an assembly reference.

3.
AnneG AnneG says:

Check out the Cider August CTP Release Notes at channel9.msdn.com/.../Cider.AugustCTPReleaseNotes.  

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading