One of the significant benefits of Silverlight is the ability to share code with WPF desktop applications. Unfortunately, in practice there are quite a few hurdles to sharing code, due mainly to the restricted set of classes available in Silverlight’s framework.
One consequence of the way Silverlight is built is that class library projects can only be referenced if they are created specifically as Silverlight projects, and Silverlight class libraries can’t be used by standard .NET projects. The standard workaround for this is to create 2 projects, one Silverlight, the other standard .NET, and share all of the code files by either keeping the projects in a shared folder or by adding them as links to one of the assemblies. This is ok but creates a dual-maintenance headache and also requires that all “shared” projects are actually compiled twice into separate assemblies that must each be managed.
Fortunately, the restrictions on referencing projects are primarily a mechanism in Visual Studio and if you’re careful it’s actually possible to trick it into using a single project that can be referenced by Silverlight or full .NET applications. If you can keep to basic parts of the BCL that are available everywhere you can even compile to a single assembly that will work in both environments!
I’m still working out how to get this completely set up in a practical application but I’ll post more when I do.