Day as usual, I was assigned some task to do in project, that I am working on. To meet the requirement I had to update service reference to one of WCF web-services included in solution. This was nothing new, service was in this solution almost from the start of the project, even before I got to work on it, being one of it’s central parts. I was really surprised, when operation, that I’ve completed many times before failed with error:
Error 27 Custom tool error: Failed to generate code for the service reference ‘<<serviceName>>’. Please check other error and warning messages for details.
After looking through the warnings I’ve found that three of them seemed to be the causes of this error. They looked something like this:
Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
<some more info, some XPaths>
and alike for “port” and “portType”. I’ve looked at Reference.cs – there was no code inside, only some generated, commented out header.
That’s a bummer! After googling I’ve found that most popular solutions were:
- remove reference, restart VS, add it from scratch
- try restarting machine
- check “Reuse types from referenced assemblies”
- if you have installed VS2012 uninstall it reinstall VS2010
First and second one did not work. Third one was no good solution. Well, it made service reference to update, but in project referencing it I had all types doubled, so ambiguous types references all over the place. Fourth solution did not help.