EDIT - I got it to work with SL 3 runtime...
I had to remove all the old references to System.ServiceModel and System.Net and add them back from this location (I run x64 windows)
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0
Once I did that - it worked! Sorry if you're still targetting the 2.0 runtime but I thought I'd post this update in case anyone finds this page in the future...
This might have just been "my issue" since I use x64 windows... Here is what the new proj file looks like for the assembly references:
<Reference Include="System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\System.Net.dll</HintPath>
</Reference> <Reference Include="System.ServiceModel, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\System.ServiceModel.dll</HintPath>
</Reference>
=============== OLD answer below ===============
I've been trying to do the exact same thing with no luck so I'm gonna say "this can't be done at the moment" and that's REALLY annoying...
If you look at the reference.cs and the emitted .cs the top of the class shows you that using "Add Service Reference" you get:
// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 2.0.5.0
Using SlSvcUtil (a v3.0 tool btw) you get:.
// This code was auto-generated by slsvcutil, version 3.0.40624.0
So I don't think you'll be able to "back port" to v2.0. Unfortunately - you also CAN NOT use SlSvcUtil with the 3.0 runtime! (which I find ludicrous - or I just can't get it to work properly)
I am targetting the 3.0 runtime and used SlSvcUtil and "out of the box" it tells me
The type or namespace name 'FaultContractAttributeAttribute' does not exist
in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
The class DOES exist in System.ServiceModel 3.0.* but Silverlight is using 2.0.* where it does not exist... The kicker - try adding a reference to the 3.0 version and you get greeted with:
You can't add a reference to System.ServiceModel.dll as it was not built against the
Silverlight runtime. Silverlight projects will only work with Silverlight assemblies
So even if you were on v3.0 - you'd be SOL - just like me...
Hopefully someone can reply telling us HOW to do it but I don't think it's possible... SOMEONE - PROVE ME WRONG PLEASE!!! :)
Sorry man...