tags:

views:

410

answers:

2

If you have

interface IServiceA { string GetString(); }

Is there a way to share this interface beween the WCF web service project and a silverlight project.

The problem, both use different versions of System.ServiceModel

I DON'T want to generate and use proxies.

A: 

Place the contracts(IXyz) in their own project and reference it there. When you deploy be sure to add a reference path to the appropriate assemblies.

Adam Fyles
Thanks.But, IServiceA interface has ServiceContract attribute, which means that separate project has a reference to ServiceModel, and to make it accessable by silverlight it's a silverlight project hence the ServiceModel ver. is 2.5.But the wcf web project uses ServiceModel ver. 3 ..
+1  A: 

You can try to use inheritance on interfaces. Create a base interface (you can use Resharper to extract interface out of existing ones) and place it into separate class library. Then inherit your service contract interface (the one that you mark with attributes) from the base interface. Use assembly with your base interface in your Silverlight project.

bychkov
ThanksA nice good work around, but would require a base interface and two different inherited interface, as both used by silverlight and WCF requires the attributes. But interfaces would be identical, so I would end up with 3 different interfaces (base and two children) being exactly the same.