views:

34

answers:

1

I have a project that I'm upgrading from 2008 to 2010.
My problem is with the code being generated by a service reference. Any classes used in the Reference.cs are given by their full name according to the reference

The difference results in a 'cannot convert from foo.Data.MtkBaseRequest to foo.WebServicesClient.ModelDataService.MtkBaseRequest'

So I have the old code

namespace foo  
{  
  public abstract class MtkBaseRequest{}  
}

And this code being called

List<MtkBaseRequest> newList = new List<MtkBaseRequest>(requestArray);  
this.DataAccessWebService.doStuff(newList);

but this is the method it means to call(which is generated)

public void doStuff(System.Collections.Generic.List<foo.WebServicesClient.ModelDataService.MtkBaseRequest> requests)

So what's happening is that the namespace no longer matches for the class which should be the same. In the code generated by VS 2008 the method being called is:

public void doStuff(System.Collections.Generic.List<foo.Data.MtkBaseRequest> requests)

Is there a work-around, or something I can do to get the code generating properly?

BTW: the project this is in is called WebServicesClient, the service reference is ModelDataService

A: 

I had to go back to that configure service reference page and check the 'reuse types in specified referenced assemblies' Then uncheck mscorlib.
This fixed the namespace issue in most cases, but there was still System.Type which was behaving oddly. So I removed the partial class Type : ... from reference.cs and had to do a find replace from foo.WebServicesClient.ModelDataService.type to Type which turned out to be only 2 instances.

It's a workaround, and not perfect so I'm just noting it here and won't accept it as the answer

Jean-Bernard Pellerin