I’ve been battling this now for an hour or so, and as all the reponses I’ve seen online haven’t really helped, I thought I’d whack this up..
The error I got was:
The code generator 'Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator' encountered a fatal exception and could not generate code for project 'TheProject.csproj':
Exception has been thrown by the target of an invocation.
Now, searching online comes up with loads of things, but the most important one I found was on Microsoft Connect. It’s actually a comment from ArielBH, which says:
From my exprience it is connected to the DataAnnotions attributes when it is looking for types in the resx.
When I tried to manipulate the Buisness Applocation template and move Ria Services link and files to other assembly I had the same issue. When I removed all references to those resx files this issue disappered.
I indeed have a class using DataAnnotations linking to a resx file… So, I removed all the attributes linking to the resx files, (i.e. removing all the validation…) and did another compile…
At this point RIA decides to actually give the correct error, that a method was missing…
So, point of note is that the DataAnnotations will mask the actual error, but once you’ve fixed the error, putting the DataAnnotations back will be fine…
Monday, January 23, 2012 10:00 PM