When you attempt to use the slsvcutil.exe command line tool to generate a proxy for Windows Phone, you get an error that looks like:

Error: An error occurred in the tool.

Error: Could not load file or assembly ‘C:\Program Files (x86)\Microsoft Silverlight\5.0.61118.0\System.Runtime.Serialization.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Cause

This is caused if the developer has both the Windows Phone SDK 7.1 or 7.1.1 AND Siliverlight 5 installed on the developer computer. Silverlight 5 changes a registry key that slsvcutil relies on to determine which assemblies to load.

Resoulution

The fix is to explicitly use a config file to specify the supported runtime version. The developer should supply a config file alongside the actual slsvcutil.exe file in the Windows Phone 7.1 tools folder (e.g., C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools). This config file should be named:

slsvcutil.exe.config

and should have the following contents:

<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

After ensuring a file with these contents with the name slsvcutil.exe.config are in the same directory as slsvcutil.exe, then invoking slsvcutil.exe should work properly.

Advertisements

Share your thoughts

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s