User Controls won't load from DLL file RRS feed

  • Question

  • I've created a library (DLL) in Expression Blend that contains two user controls.  If I add a reference to the library in Expression Blend, it recognizes the controls as Custom Controls in the Asset Library.  Anyway, if I try to add the control from my library to my WPF Application interface, I get a gray box with a red and white exclamation point icon that says "Cannot create an instance of"Flathead". (the control is a flathead screw)  I tried this several times, updating the DLL, rebuilding the two projects...it hasn't worked.  So I went into Visual Studio 2008, attempted to add the control I wanted, and like magic, it all worked.  Everything appears as it should in VS 2008, but Expression Blend is getting errors.  The InnerException that I see in Expression Blend says: "Cannot locate resource 'usercontrol2.xaml'.  What could be happening here?

    I'll add that if I run the project from VS 2008, it runs fine.  If I select "Test Solution" from Blend and run the project, it also runs fine -- the controls are there!  It's just in the editing environment in Blend where things get a little weird.
    Friday, November 21, 2008 3:27 PM

All replies

  • Saturday, November 22, 2008 12:37 AM
  • This also touches on the topic:


    I tried implementing the solution here, but I couldn't get anything to work differently...maybe I just didn't get exactly how to do things correctly...

    Strangely enough, after altering my code with the solution from that link, then changing it back to the original code, some of my user controls appeared in Blend, and some still are missing.  I don't get it.
    Saturday, November 22, 2008 3:07 AM
  •  Hi,

    Is it possible for you to share your project or a part of it with the issue. It would greatly help in investigating this scenario.

    Jeetendra Kukreja [MSFT]
    Monday, December 1, 2008 11:09 PM
  • I finally figured out what I guess was the conflict.  I have several projects under one solution.  At some point during those projects, I decided to create a library (DLL) for some common things I was using.  I couldn't tell you when I started seeing problems with exceptions arising in Blend, but it must have been sometime after I installed SP1...beyond that, I don't remember.  At any rate, the very first original project in the solution wasn't using that handy DLL, but had its own resources set up to make similar controls.  At some point, this caused a conflict, but a conflict that you don't see in the VS 2008 Designer.

    From what I've read, it seems like the VS 2008 Designer may have, at one time, had a similar issue, but Blend also suffers from this problem.  My original project had a UserControl in it, and I think this was causing the conflict.  Everything (so far) is behaving properly with the UserControl pieces removed.  What is most irritating about this problem is that VS 2008 works fine with it, whereas Blend doesn't...is this a "user" flaw that VS 2008 decided to accept, or has Blend just not caught up yet?
    Wednesday, December 3, 2008 7:02 PM