I’m trying to follow this tutorial to create a proxy class for my WCF service for a MonoTouch project, but when I run the command
C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Tools\SlSvcUtil.exe /noConfig http://yourdomain/yourservice/wsdl
I get the following error:
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.
Looking under C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Client doesn’t have a System.Runtime.Serialization.dll. Maybe that’s the problem and it tries to use the latest .net dll, which won’t work with Silverlight.
Any ideas?
This seems to be an issue when multiple SDKs (WP7.1, WP7.1.1, Silverlight 3, 4, or 5) are installed on the same machine. The solution is to tell SlSvcUtil to use the right assembly and .net version by adding an SlSvcUtil.exe.config file to the same folder where SlSvcUtil lives, which in my case is %PROGRAMFILES(x86)%\Microsoft SDKs\Silverlight\v3.0\Tools: