17

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> in the XAML, 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".

This is my XAML:

<Window x:Class="QueryBuilder.Table"
        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"
        Height="300" Width="300" WindowStyle="ToolWindow" ResizeMode="NoResize" ShowInTaskbar="False">
</Window>

This problem has been frustrating me all day. I've tried almost everything imaginable. One thing worth noticing is that I've downlaoded the sample application from the library's site, and I can run it with no problems. Besides this, I have added this to the xaml.cs class of my project: WPF.MDI.MdiContainer d = new WPF.MDI.MdiContainer(); and it compiles with no problems at all.

Please also note that my initial problem was asked here, and none of the suggestions worked. The problem has now changed however, due to the above paragraph which seems to indicate that the code is compiled successfully in the code behind, but not in the XAML file.

EDIT: I would also like to add that I am able to browse through the code of the assembly reference as shown below.

enter image description here

Community
  • 1
  • 1
Dot NET
  • 4,891
  • 13
  • 55
  • 98

3 Answers3

10

I've finally solved the problem myself - going to leave this answer here incase someone has the same problem some time. Adding the solution itself to the reference path of the assembly solves the problem! It's a shame this isn't documented...

EDIT: To clarify, what I did was add the solution, rather than the dll. In other words, I added the MDI solution with all its classes. This naturally applies to DLLs where the source code is available too.

Dot NET
  • 4,891
  • 13
  • 55
  • 98
  • 10
    Can you please clarify this with an example? I'm not sure what you mean – msnider Jul 04 '14 at 14:09
  • Added some clarification. I hope this helps, as this problem was extremely frustrating for me! – Dot NET Nov 11 '14 at 15:20
  • Yes, but I don't have the solution, but only the DLL =/ – Tito Jan 06 '15 at 18:54
  • @DotNET, adding a solution is not possible in all scenario. For example, how could we get the source project for 3rd party dll's. – Kira Jul 29 '15 at 10:22
  • did you mean adding a project's dll to the references? It helps indeed, but this is not applicable in cases when different project configurations are built into different folders – Dmitry Gusarov May 03 '20 at 23:44
9

If Visual Studio keeps complaining and underlining even after you tried everything, terminate the XDesProc.exe process using Task Manager and then rebuild the solution.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Ondřej
  • 1,645
  • 1
  • 18
  • 29
1

Got sln file from http://wpfmdi.codeplex.com/. Built that project and used the new .dll from bin, used that, then it worked fine for me.

Jasperan
  • 2,154
  • 1
  • 16
  • 40
Rashmi S
  • 267
  • 1
  • 7
  • 20