views:

30

answers:

4

I am using a base Window class in a WPF project. In the code behind C# file the assembly to the base type is referenced and fine. In the XAML is looks like this:

<MyNamespace:WindowBase x:Class="MyNamespace.Applications.UserInterface.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:MyNamespace="clr-namespace:MyNamespace.Somewhere;assembly=MyNamespace.Common"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
    </Grid>

The solution compiles fine and I can run it. I just can't use the designer in VS 2010. It throws the following exception: The type'MyNameSpace:WindowBase' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

Well. they have been. I can't understand what this issue is. This particular base class is used in other projects just fine. I grabbed it for a new project and I can't use the designer. Very frustrating.

A: 

I dont't know if its the same issue but in VS2008 I tried to make abstract UserControls but had to change this because the designer didnt't support any abstract base classes (however the solution was compilable and also worked as excpected).

Heinz K
Works in 2008. Coworker has it working in 2010 against .NET 4.0. No idea what's different between our machines... This is weird.
Chris Holmes
+1  A: 

Whenever the designer is acting up against me - the first thing I do is clear the obj-folders in the project and rebuild. Sometimes they seem to go out of sync for some reason (usually when I'm drag-dropping a lot of files and renaming visual items).

Goblin
No dice. Thanks though.
Chris Holmes
A: 

Fixed. The library that contained my base class resided on a drive on the network that I did not have permissions to. That seemed to have no affect on VS 2008 as it worked, but VS 2010 apparently took exception to that when the designer tried to load it. Weird.

Chris Holmes
If you copy the dll from a network path, you must right cluck, properties, then 'unblock'! Only the designer complains, weird isn't it?! Will post this into An answer shortly...
Kieren Johnstone
+1  A: 

Found this problem just recently (this answer upgraded from a comment).

If you copy the dll from a network path, you must right click on the file in Windows Explorer, select Properties, then 'unblock'; there is a hidden NTFS stream associated with the file, and many files when you download from the 'net or copy from a network path, for security reasons.

Only the designer complains, yet the project builds and runs fine: weird isn't it?!

Kieren Johnstone