I’ve been struggling trying to work with the new SharePoint 2010 Silverlight client object model on a new environment I setup. This has SharePoint 2010 Beta 2 and Visual Studio 2010 Beta 2… nothing special, that’s it (along with the dependencies such as SQL Server and everything they require).
To work with the Silverlight client object model you have to add two references to your Silverlight project. These two assemblies (Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll). These can be found in the [..]\14\TEMPLATES\LAYOUS\ClientBin folder. However I was having an issue.
After opening Visual Studio 2010 Beta 2, I created a Silverlight application that targeted .NET 3.5. When prompted I let the project wizard create an associated ASP.NET Web application to test it. Everything was good… until I tried to add a reference to the two SharePoint Silverlight client object model assemblies. When I added them, they appeared with little warning icons… which you know is not good. So I jump to the code file MainPage.xaml.cs and try to add some using statements… specifically to Microsoft.SharePoint. Uh oh… it won’t resolve!
Well get this: when you create a new project and accept the default path, it goes in something like this: c:\users\[username]\documents\Visual Studio 2010\Projects\[Solution/Project Name]. When I moved the project to a more shallow path such as c:\Demos\[Solution/Project Name] and opened it in Visual Studio 2010 beta 2, it worked just fine!
The skinny: It appears that if you have a deep path, Visual Studio 2010 has trouble referencing some assemblies… for me, that’s the SharePoint 2010 Silverlight client object model. The fix: don’t work with projects nested deep in folders. I’ll file this as a bug and cross my fingers.