Silverlight 5 with WCF RIA Services

Mar 7, 2012 at 8:44 AM

When generating documentaion for a Silverlight dll which uses WCF RIA Services one will receive errors like the one below

"Unresolved assembly reference: System.Windows (System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) required by System.ServiceModel.DomainServices.Client"

To build the configuration one must configure the assembly binding redirection plugin in order to redirect all assemblies used by the wcf ria dll's to use the silverlight 5 version of them. This is quite straightforward once you have found the instructions for how to do it, but it still takes quite some time.
I think these assembly redirects should be performed automatically when targeting Silverlight 5.0.

The fastest way to perform the required redirects is to open the .shfbproj file in a text editor and find the PlugInConfigurations tag (it should be located just below VisibleItems) and paste the required redirects (see below for my working configuration).

<PlugInConfigurations>
<PlugInConfig id="Assembly Binding Redirection" enabled="True">
<configuration>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="mscorlib" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Core" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Data" publicKeyToken="7cec85d7bea7798e" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.DataAnnotations" publicKeyToken="ddd0da4d3e678217" />
<bindingRedirect oldVersion="2.0.5.0" newVersion="5.0.5.0" />
</dependentAssembly>
</assemblyBinding>
</configuration>
</PlugInConfig>
</PlugInConfigurations>

Coordinator
Mar 7, 2012 at 4:01 PM

Setting the FrameworkVersion project property to Silverlight 5.0 should take care of that automatically without the need for the binding redirection plug-in.

Eric