Missing System.Windows reference

namespacesreferencesilverlight

I have a Silverlight application where I need to use the Vector class in System.Windows within the Web project. But VS is complaining that System.Windows does not exist. I tried adding the reference, but it's not in the list of namespaces to add. In the .NET tab, it goes from System.Web.Services to System.Windows.Forms and skips System.Windows altogether.

What's really strange is that System.Windows DOES exist int the reference list in the Silverlight project. Furthermore, I have another Silverlight app on this machine with exactly the same setup (two projects, one Silverlight, one Web), and the reference is there.

I saw someone else here had a similar problem, but none of the solutions worked for me. Has anyone else experienced this?

Best Solution

I found it! You have to add a reference to WindowsBase.

The usual way (I guess) to set up a Silverlight app is to have two projects: one for the Silverlight client code, and one for the server side aspx pages. The Silverlight reference pool has System.Windows available in it. The aspx reference pool does not. What it has instead, is the "WindowsBase" dll, which makes the System.Windows namespace (and probably others) available in your "using" block. But it's not included in the project by default.