views:

146

answers:

2

I recently added a control library project to my Silverlight app's solution, so the solution now has three projects:

  • SLClient
  • SLClient.Controls
  • SLClient.Web

SLClient has a project reference to SLClient.Controls, which contains the following:

  • Themes
    • Generic.xaml (contains default CustomTextBox template)
    • Templates.xaml (contains additional template used by CustomTextBox)
  • CustomTextBox.cs (Descended from System.Windows.Controls.Control)

The xaml files above have Build Action of "Resource" and an empty Custom Tool property. Everything builds fine, but when the XAML files (a view, and my App.xaml that merges in SLClient.Controls's Templates.xaml) in SLClient that reference SLClient.Controls are open, Visual Studio tells shows an error in the "xmlns:SLClient_Controls="clr-namespace:SLClient.Controls;assembly=SLClient.Controls" line:

Assembly "SLClient.Controls" was not found. Verify that you are not missing an assembly reference [...]

Update: The page not loading, which I had previously mentioned, was caused by a different error in my XAML. I still get this error though, and would still like to know what's causing it. Is it a bug in the XAML compiler? The code generated from the XAML compiles fine.

A: 

sounds like a hokey reference. Try this:

  • Delete the reference in the project and the xmlns ref in the XAML.
  • Clean and rebuild all the projects
  • Re-add the project reference.
  • Build
  • Re-add the XAML xmlns reference
  • Rebuild

HTH,
Mark

Mark Cooper
Hey, I tried that, and no success. Any other ideas?
Dov
+1  A: 

If you have added references in SLClient.Controls's project , then currently those assemblies are not automatically referenced in SLClient as expected as they do in normal .NET 2.0 projects.

So please verify that all the references in SLClient.Control's project are also manually added in SLClient project as well. For example if you add System.Windows.Toolkit reference in SLClient.Control, then you will also have to add the same reference in SLClient.

This is known bug and I have already reported this bug to Microsoft. And its still under processing.

Akash Kava
Actually, SLClient has a reference to every reference from SLClient.Controls already.
Dov
Can you make sure both SL projects have same framework type, like 2.0 or 3.0, and when you get error in Visual Studio, can you click on "Copy error to the Clipboard" and paste it in the notepad, may be you will see some more detail about the error. It could also be possible if you have any exception in any static constructor, it may not find some type or it could not load the types correctly.
Akash Kava
I don't see that button in Visual Studio - where is it? In the "Error List" window? I only see "Copy", which basically copies the same text I saw in the IDE. It just adds the file's name, and the error's line and column. Also, all of the references are of the same version (2.0.5.0).
Dov
Copy error to clipboard is viible only while debugging, it's a small yellow colored tag on error line where you can clck and view details
Akash Kava