2

I've got a strange problem adding a dll reference. I've got a WPF application and am trying to use the WPF MDI library: http://wpfmdi.codeplex.com/

As stated in the instructions (which are very vague), I right-clicked on references in VS2012, clicked on Add reference.., clicked on Browse.. and added my dll which I downloaded.

Next, I added the following line in the XAML of my window: xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI" as stated in the instructions.

However, when trying to add an <mdi:MdiContainer>, the following error messages are displayed:

The type 'mdi:MdiContainer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

The name "MdiContainer" does not exist in the namespace "clr-namespace:WPF.MDI;assembly=WPF.MDI".

Any ideas?

EDIT:

Added my XAML file

<Window x:Name="..." x:Class="MyClass.MyClass"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
        Title="" WindowState="Maximized">
    <Window.Resources>
        <Style TargetType="TreeView">
            <Setter Property="Padding" Value="0,0,20,0"/>
            <Setter Property="BorderBrush" Value="Gray"/>
            <Setter Property="BorderThickness" Value="0,0,5,0"/>
        </Style>
    </Window.Resources>
    <mdi:MdiContainer></mdi:MdiContainer>
</Window>
8
  • Did you set the reference to copy local? Pretty sure you need to for the namespace to resolve. Commented Oct 14, 2012 at 16:58
  • 1
    Check the DLL reference, Copy to Local should be true. And try building the project once before adding any reference in XAML file. Commented Oct 14, 2012 at 16:58
  • Tried that too, still no luck :/ Commented Oct 14, 2012 at 17:01
  • I've edited the question to show the error messages I'm receiving Commented Oct 14, 2012 at 17:05
  • just curious, are you able to see the WPF.MDI namespace in codebehind file and use it. I mean try accessing the type once from WPF.MDI namespace in code behind instead of trying in XAML and see if the namespace and type are visible and project gets compiled or not? Commented Oct 14, 2012 at 17:19

3 Answers 3

3

The project at MDI Project seems to use .Net 4 Client Profile. Just make sure the WPF.MDI project has been compiled using .Net Framework 4 runtime.

Sign up to request clarification or add additional context in comments.

5 Comments

I'm wondering if I'm doing something wrong - do I have to add the project too? All I've added is the dll
I've added the project to the solution and the problem is still here
Just for a simple test, create a new Console Application project, add the reference to WPF.MDI DLL and access the MdiContainer type in Main method. If the code compiles then WPF application code should compile too. Just make sure Console Application project uses the same runtime version as of WPF.MDI DLL. You can check the WPF.MDI DLL's CLR version using ILDASM command.
I've tried something similar - I went into the xaml.cs class and created an WPF.MDI.MdiContainer object. This worked, however I still cannot seem to create one in the XAML
Thanks for the help, but I'm still out of luck. I'll try asking a new question based on the new details, since the situation has fundamentally changed since the code compiles in the cs file.
1

Check .NET Framework settings of your project. Make sure it is not set to .NET Framework Client Profile. Because as per my experience this error usually appears when there is a mismatch in the framework settings. Hope this helps!

8 Comments

Where can I find these settings?
Right-click on your project and select Properties. On the Application tab you can find the Target framework, verify that setting.
Ok now do one thing, get the source of WPF MDI from this link wpfmdi.codeplex.com/downloads/get/184338 and include this project in your solution by setting its framework to 4.5 and see if it works for you.
Try downgrading your project's framework to see if it working or not.
I'm wondering if I'm doing something wrong - do I have to add the project too? All I've added is the dll
|
0

Download the source for the DLL from the MDI Project. Recompile to current .net version and then re-add as a reference and recompile your project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.