RIA 服务出现奇怪的错误“代码生成器遇到致命异常”

发布于 2024-10-22 23:57:23 字数 341 浏览 1 评论 0原文

这是我第二次在 WCF RIA 服务中遇到这个非常奇怪的问题!可悲的是,我必须两次解决这个问题,再次经历不同的麻烦:(,尽管我给自己留了一张纸条指向解决方案:P

无论如何,“非常有用”的错误消息如下:

...\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Ria.Client.targets(304,5):错误:代码生成器“Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator”遇到致命异常并且无法为项目“ProjectA”生成代码

This is the second time that I have this really weird problem with WCF RIA Services! the sad thing is that I had to solve the problem twice, going through the different hoops again :(, even though I've left a note to myself pointing to the solution :P

Anyways, the "pretty useful" error message is the following:

...\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Ria.Client.targets(304,5): error : The code generator 'Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator' encountered a fatal exception and could not generate code for project "ProjectA"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风筝有风,海豚有海 2024-10-29 23:57:24

经过一番尝试(一段时间)后,我发现了“真正问题”的根源,那就是,我在网络应用程序(主机)中使用了一些资源文件(.resx),并链接从我的 silverlight 项目 (ProjectA) 发送给他们。问题出在生成的资源类的命名空间中。为了解决这个问题,我必须确保对于原始 .resx 文件以及链接,以下属性设置正确:

"Custom Tool" is set to PublicResXFileCodeGenerator
"Custom Tool Namespace" is set to the same namespace ("ProjectA.Web.Resources" in my case)

这个晦涩的问题很难重现。一旦我解决了它,尝试改变属性并没有把它带回来:

不管怎样,我自己写的注释在这种情况下帮助了我,这就是为什么我希望这篇注释能帮助其他遭受这个问题的人(也许将是未来的我 :P )

after toying around (for a while), I found the source of the "real problem" which was that, I was using some resource files (.resx) in the web application (host), and linked to them from my silverlight project (ProjectA). The issue was in the namespace of the generated resource classes. To solve this issue, I had to make sure that, for the original .resx files as well as the links, the following properties are set correctly:

"Custom Tool" is set to PublicResXFileCodeGenerator
"Custom Tool Namespace" is set to the same namespace ("ProjectA.Web.Resources" in my case)

this obscure problem is hard to reproduce. once I solved it, trying to alter the properties didn't bring it back :s

anyways, the note I wrote myself helped me in this situation, that's why I hope this note would help somebody else out there suffering from this issue (maybe that would be future me :P )

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文