I have a Silverlight application with a web application to test it,
there are two WCF services I created on my web application.
I can add reference all my services in my Silverlight application but when I want to use one of my data contracts ,I can not add my service namespace to the Silverlight application:
ex: I have a person class in my WCF service(reference name)
WCF service.person = new wcfservice.person();
The type or namespace name 'WCF service' could not be found (are you
missing a using directive or an assembly reference?)
I can add reference all my services in my Silverlight application but when I want to use one of my data contracts...
You can't bring in the namespace because it exists in an assembly which has been complied in a different CLR. But that doesn't mean one can't work with the defined class. By bringing the target class(es) into the Silverlight project via the use of a linked file one can safely work around the CLR differences.
A linked file is built in both projects, the original and the linked, but only resides in one location; hence changes made to it are reflected in both projects.
In the Silverlight project
add the target file(s) and then choose:
That way you can use the class within the namespace as such, for it is compiled into the Siliverlight programs scope; but any changes made to the file are also reflected in the Silverlight app.