Service reference generates empty files and throws errors

*Moved to: http://fluentbytes.com/service-reference-generates-empty-files-and-throws-errors/

Today I wasted at least an hour or two on issues with service references. In one of my previous blog post I wrote about building a mobile application that uses the RIA services via a SOAP endpoint. My colleague an I decided we wanted to clean up the solution and change some of the namespaces. In doing this I also wanted to rename the service reference. So what do you do?

Well just enter F2 to rename the service reference right? Well not quite. That miserably failed with a crash dialog in visual studio. So next I tried to add the service reference again, but apparently my previous action crippled visual Studio in such a way that it now refused to generate any code any more. Period Confused smile

Messages I got where the following:

Custom Tool Failed

and

Failed to generate code for the service reference ‘myserviceReferenceName’. Please check other error and warning messages for details.

Great, but what other messages? there aren’t any …..

After long period of digging around I found the tool keeps some sort of a cache folder for the service references in the following location:

C:Users<yourUserName>AppDataLocalMicrosoftVisualStudio10.0ProjectAssemblies

I finally fixed the problem by closing visual Studio, and then delete all directories at that location.

Next I added the service reference again, and now it finally generated code again.

Very frustrating, hope this post can help you when you hit the same error.

cheers,

Marcel

Follow my new blog on http://fluentbytes.com