为什么与我的 Silverlight 客户端共享资源文件 (resx) 如此困难?
我试图通过将资源文件链接到我的客户端来将资源文件(.resx 文件)从我的网络(RIA 服务?Silverlight 主机)共享到客户端(Silverlight)。当我尝试使用 ResourceManager
对象访问资源时,出现以下错误:
System.Resources.MissingManifestResourceException was caught
Message=Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "PPCa.Modules.ProjectManager.Client.ViewModels.ResourceStrings.resources" was correctly embedded or linked into assembly "PPCa.Modules.ProjectManager.Client" at compile time, or that all the satellite assemblies required are loadable and fully signed.
StackTrace:
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetString(String name)
at PPCa.Modules.ProjectManager.Web.Helpers.ResourceHelper.GetEnumText[TResource](ProjectStatus a_projectStatus)
InnerException:
编辑:
当我说我正在链接资源文件时,我的意思是我正在使用“添加”将现有 resx 文件添加到我的项目时作为链接选项。
I'm trying to share a resource file (.resx file) from my web (RIA Service?Silverlight Host) to client (Silverlight) by linking the resource file into my client. When I try to access resources using the ResourceManager
object I get the following error:
System.Resources.MissingManifestResourceException was caught
Message=Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "PPCa.Modules.ProjectManager.Client.ViewModels.ResourceStrings.resources" was correctly embedded or linked into assembly "PPCa.Modules.ProjectManager.Client" at compile time, or that all the satellite assemblies required are loadable and fully signed.
StackTrace:
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetString(String name)
at PPCa.Modules.ProjectManager.Web.Helpers.ResourceHelper.GetEnumText[TResource](ProjectStatus a_projectStatus)
InnerException:
Edit:
When I say I was linking the resource file, I mean I am using the 'Add as Link' option when adding the existing resx file to my project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我目前也在解决这个问题。我已将问题范围缩小到名称空间。对于我来说,我创建了一个 Silverlight 业务应用程序,并且想要重命名该 Web 项目并更改其命名空间。我一这样做,SL 项目就崩溃了。
检查此。第 5 步的注释解释了这种情况,但我目前正在尝试找到解决此问题的合适方法。
编辑:这对我有用: http://forums.silverlight.net/forums/ p/184013/420509.aspx
I'm currently working through this issue at the moment too. I have narrowed down the issue to namespaces. For me, I created a Silverlight Business Application and I wanted to rename the web project and change its namespace. As soon as I did this, the SL project became broken.
Check this out. The notes on step 5 sort of explain the situation, but I'm currently trying to figure out a decent way around this.
EDIT: This worked for me: http://forums.silverlight.net/forums/p/184013/420509.aspx
一个(有问题的)解决方案是:
它有效,但我质疑拥有 resx 文件的单独副本的可行性。除了必须确保对 Web resx 文件的更改手动复制到 silverlight 客户端 resx 副本之外,是否还有其他潜在的陷阱......或者是否有替代解决方案。
A (questionable) solution was to:
It worked but I question the feasibility of having separate copies of resx files. Other than having to ensure changes to the web resx files are manually duplicated to the silverlight client resx copies, are there any other potential pitfalls ... or is there an alternative solution.
检查 Silverlight 业务应用程序模板(创建新项目,选择 Silverlight 业务应用程序模板)。
*.resx 共享在该项目中通过添加现有项目作为链接成功实现 ->在 Silverlight 端项目中,添加现有项目,选择 *.resx 文件,检查“添加”按钮,展开它并选择“添加为链接”选项。
Examine the Silverlight Business Application template (Create a new project, select the Silverlight Business Application template).
*.resx sharing is succesffully achieved in that project via Adding existing items as links -> In your Silverlight-side project, AddExisting item, Select your *.resx file, examine the 'Add' button, expand it and select the 'Add as link' option.
添加为链接作为解决方案部分解决了这个问题,如果我将资源文件(添加为链接)放在不是模板创建的文件夹中的另一个文件夹中,您将再次收到此错误,您将不得不将所有如果您计划使用该模板,则将资源放在同一 Web\Resources 文件夹中。
但是,如果您想将其他服务与其自己的资源(Ria 服务)链接起来,那么如果我尝试任何方法直到今天,我仍然会收到这个可怕的错误
The add as link as solution, partially solves this problem, if I put a resources file ( added as link) in another folder that is not the one that the template created, you will receive this error again, you will have to put all your resources in the same Web\Resources folder if you plan to use the template.
But what happen if you want to link other services with their own resources ( Ria services), well if I try any method till this day, and I still receive this freaking error