0
votes

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();

Error:

The type or namespace name 'WCF service' could not be found (are you missing a using directive or an assembly reference?)

1
I have this error too: Error 6 Custom tool error: Failed to generate code for the service reference 'WCFservice'. Please check other error and warning messages for details. D:\....\WCFservice\Reference.svcmap 1 1 appname - Ali pishkari

1 Answers

0
votes

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:

enter image description here

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.