I was working on Windows Service that was consuming another WCF Windows Service. I created a Service Reference in Visual Studio 2008 and noticed that client code was not automatically generating. The error I was getting was
Error 4 Custom tool error: Failed to generate code for the service reference 'MyWindowsService'. Please check other error and warning messages for details.
The Windows Service I was working on was already full blown project with lots of references, so to limit possibilities I created another empty windows service and added Service Reference to one I need. Client code was generated with no problems! I decided to use new Windows Service as a base and added all required functionality to it and selected “Update Service Reference” and again it failed to generate a code!
After some time looking around there was an easy solution to fix a problem. You need to edit Service Reference Configuration by selecting “Configure Service Reference…” from right click menu.
In the dialog box Un-tick “Reuse types in referenced assembles” and click OK. Try to Update Service Reference. This worked for me!
Nice! Thanks! You saved me!
ReplyDeletesaved me too! I spent WAY too long on this
ReplyDeletethank-you
Thanks! I got this error when I started using compression (http://dimebrain.com/2008/06/compression-i-1.html). Had no idea that it was related until I read this page.
ReplyDeleteThanks! I would never have found this one...
ReplyDeleteAny idea what that option (Reuse types) is for?
ReplyDeleteThank you! Developing a demonstration with Telerik Drag and Drop Silverlight Control, which communicates with an SQL Server database, and required a web service.
ReplyDeleteThanks!!!
ReplyDeleteReuse Types need to be ticked to define classes in referenced DLLs that should not be generated, but reused from their definitions.
ReplyDeleteThanks!! It was driving me crazy!
ReplyDeleteMy thanks as well! Wow.
ReplyDeleteDave
Thank you very munch!!
ReplyDeleteThank you!! That saves me!
ReplyDeleteWsdl not updating problem fixed nicely. Very well done sir, you've saved my hair.
ReplyDeleteThank a lol for this solution.
ReplyDeleteIt worked!! Thank you. I wonder why it worked before with that option checked, but not anymore. Can anyone explain?
ReplyDeleteNot good when I need to reference the types. This was working until yesterday, then I added a generic property to a web service, obviously this refused to be run-time serialized (although it would compile fine). Removing this property and rebuilding everything several times and still it wont generate the reference.cs. Why is this so much hassle? Where is the feedback from the Microsoft tools? Their usability is shockingly poor.
ReplyDeletethanx a million!
ReplyDeleteI can't believe Microsoft left it ticked as default, what a bugger! Annoying!!!!!
ReplyDeleteMy thanks to this post as well.
Oh man, you rock. Super quick fix!
ReplyDeleteThank you, I was losing my mind
ReplyDeleteThis is not a solution!
ReplyDeletethanks man, awesome, fixed straight away, LEGEND.....
ReplyDeleteThank you!!! Thank you!!! Thank you!!!
ReplyDeleteThanks a lot....That worked like a charm :)
ReplyDeleteThanks very much!! Saved my day!!
ReplyDeleteBrilliant, Thank you.
ReplyDeleteThanks !!
ReplyDeleteThis was very helpful. Typically the re-use works. I need to use re-use but select specific types. This is necessary due to the multiple services sharing the same references.
ReplyDeleteabsolutely brilliant.. thanks a lot.
ReplyDeleteThanksssssssssss so mucccccccccchhhhhhhhhh
ReplyDeleteAs just said on March 19th, 2010: this is not a solution.
ReplyDeletePM&LV
Good Stuff... Life saver
ReplyDeleteGood one. This one helped me. Thank you...
ReplyDeleteThank you so much!! Saved me big time.
ReplyDeleteThank you!
ReplyDeleteThanks. I spent a lot of time on this.
ReplyDeleteI had the same problem. When I unchecked "Reuse..." it worked. When I later checked it again it still worked.
ReplyDeleteAwesome! Thanks - Saved me a lot of time
ReplyDeleteThanks, saved me a bunch of time!
ReplyDeleteomg... thank you soooooooooooooo much!!!
ReplyDeletethank you, thank you, thank you!!!!!
-worships-
ReplyDeleteI was doing the exact opposite. It didn't occur to me do un-tick the box. I'm an idiot. You're not. Thanks :)!
thanks!.. u saved me..
ReplyDeleteThanks a lot!! really helped in saving so much time...!!!
ReplyDeletethank you !
ReplyDeleteTHNX A LOT, it worked !!
ReplyDeletethx man :)
ReplyDelete... IT WORKED ... !
ReplyDeleteDoesn't help me. I need those types. And it has worked for me before. This is ridiculous and one of the reasons why I am groing to despise microsoft's development environment
ReplyDeleteworked!
ReplyDeleteso easy but it takes me so many hours
ReplyDeleteThank you
FTW Man FTW - you are the best! Like everyone else said - saved me!
ReplyDeleteNice Clue Buddy.
ReplyDeleteThanks :-)
ReplyDeleteSame issue in VS2010. Thanks for posting your solution.
ReplyDeleteWow, thank you.
ReplyDelete2 days of headache, very thanks, is that!!! solved.
ReplyDeleteGláucio.
Post is 3 years old and helped me with VS 2012!
ReplyDeleteThis appears to be the tip that keeps on giving! Thanks much!!!
ReplyDeleteThanks so much!
ReplyDeleteThanks so much!
ReplyDeleteWow... can't believe how many people had this problem... Thanks man!
ReplyDeleteIt blows my mind how many people have had this issue and not figured out what the real root of the issue was.
ReplyDeletemost of you will have 3 projects, a common, a webservice and a app that consumes the webservice. both the webservice and the app will have the common's assembly referenced.
Now unchecking the reuse types only works because you are bypassing the real fault, which is you have made a change to the common assembly and either the webservice or the app has not got the latest version, so when you update the service reference there is a mismatch and the service reference cannot properly refresh.
Simply clean all 3 projects, manually inspect each project's bin folders to ensure the common assembly is gone and in the case of a webservice running in a test vs/iis process kill that process and start it again.
Your problem will be resolved.
Dude you are a lifesaver. It took me a day to find this and it's such an easy problem to solve. Thank you!
DeleteStill works, helped me today!
ReplyDeleteThanks!! You help me a lot!!
ReplyDeleteI don't mean to be the guy who doens't fit in here, but this post did not help me. The magic checkbox didn't work. However, I was able to get it to work by following Xavier's advice (three comments up). Thanks Xavier!
ReplyDeleteThanks for sharing this information about us. Your blog is well perform. Visit website "Service Software Australia".
ReplyDeleteThank you
ReplyDeleteLife saver
Thank you so much! This was really helpful!
ReplyDeleteThanks a lot...
ReplyDeleteThank you, respect.
ReplyDeleteFantastic Lovely ..............I Love You...........It's 3.23 Am
ReplyDeleteI Helped my eye ...........................................................
Lovely Carrie the fantastic service.............
Chuck Noris spent three hours on this and could not find a solution! THANKS!
ReplyDelete