Connecting to WCF Service from XNA on Windows Phone 7

1 Jan

If you are using XNA Game Studio 4.0 to create an application targeted to Windows Phone 7, you may have tried to add a service reference to a WCF service inside visual studio and been stuck…

 

This appears to be a known issue – there is an easy workaround doing this manually with the Silverlight version of the SvcUtil application.

 

  1. Launch a command prompt
  2. Navigate to: C:Program Files (x86)Microsoft SDKsWindows Phonev7.0Tools
  3. Run SLSvcUtil /d:<output directory> <path to wsdl>
  4. Add the two created files (*.cs, and ServiceReferences.ClientConfig) to your existing XNA Project
  5. Select ServiceReferences.ClientConfig if the Solution explorer and change “Build Action” to “Content”

 

Here is an example of using the command:

C:Program Files (x86)Microsoft SDKsWindows Phonev7.0Tools>slsvcutil /d:c:mycode  http://test.com/test.svc?wsdl

 

Be sure to leverage the MSDN article for more information:

http://msdn.microsoft.com/en-us/library/cc197958%28v=vs.95%29.aspx

Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *