ASP.NET 应用程序未拾取卫星程序集
我有一个名为“TestResourceApp”的网络项目,其 Labels.resx 位于 App_GlobalResources 文件夹中。我想通过创建附属程序集来添加另一种语言。
以下是我创建卫星程序集所采取的步骤。始终显示默认文本。我做错了什么?
1) 在不同的文件夹中创建 Labels.fr.resx。
2) 生成资源文件:
Resgen Labels.fr.resx TestResourceApp.App_GlobalResources.Labels.fr.resources
3) 生成卫星程序集:
AL /t:lib /embed:TestResourceApp.App_GlobalResources.Labels.fr.resources /out:french.dll /c:fr
4) 将 french.dll 复制到 TestResourceApp/bin/fr
我已在 web.config 中将 uiculture 设置为 auto,并且更改了浏览器上的语言。
I have a web project called "TestResourceApp" with Labels.resx in App_GlobalResources folder. I want to add another language by creating a satellite assembly.
Here are the steps I took to create the satellite assembly. The default text always get displayed. What did I do wrong ?
1) Create Labels.fr.resx in a different folder.
2) Generate resource file:
Resgen Labels.fr.resx TestResourceApp.App_GlobalResources.Labels.fr.resources
3) Generate satellite assembly:
AL /t:lib /embed:TestResourceApp.App_GlobalResources.Labels.fr.resources /out:french.dll /c:fr
4) Copy french.dll to TestResourceApp/bin/fr
I have uiculture set to auto in web.config and I have change the language on the browser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我能够使用此页面来解决我遇到的一些卫星组装问题。我会再添加一些内容来检查。
反编译“中性”程序集并查看它是如何组合在一起的会很有帮助。像
ILDASM.exe
这样的工具有助于实现此目的。反编译后,查看文本输出中的“.mresource”,您应该会看到一个带有您的命名的文本。例如,如果将资源添加到 Visual Studio 项目,它们将被命名为 MyAssemblyName +“.Properties.Resources”+一种语言(如果有)+“.resources”示例:在我的例子中,我将文件命名正确,并位于相应的文件夹中(例如 Bin\en-US)。我能够通过使用 ProcMon.exe(由 SysInternals 人员)验证这一点,并且可以看到工作进程在我的 DLL 文件中查找和读取(而不是仅仅说“PATH NOT FOUND”)。但是,它没有按照预期的名称找到资源。这时,一些反汇编有助于弄清命名问题的根源。
因此,请使用
ProcMon.exe
来缩小您可能遇到的问题类型。希望这对某人有帮助。I was able to use this page to solve some satellite assembly issues I was having. I'll throw in a few more things to check.
It's helpful to decompile the "neutral" assembly and see how it's put together. A tool like
ILDASM.exe
is helpful for this purpose. Once you get it decompiled, look through the text output for ".mresource", and you should see one with your naming. For example, if you add a resource to a Visual Studio project, they're named MyAssemblyName + ".Properties.Resources" + a language (if any) + ".resources" Examples:In my case, I had the file named properly, and in the appropriate folder (such as Bin\en-US). I was able to verify that much by using
ProcMon.exe
(by the SysInternals guys) and could see the worker process finding and reading in my DLL file (instead of just saying "PATH NOT FOUND"). However, it was not finding the resource by the name that it expected it to. That's when some disassembly helped to get to the bottom of the naming problem.So, use
ProcMon.exe
to narrow down the kind of problem you might have. Hopefully that's helpful to someone.这很复杂,但对于遇到此问题的人来说,这里有一些提示:
It's complicated but here are a few tips for those who run into this problem:
您是否已在全球化中将
enableClientBasedCulture
设置为true
?Did you have set
enableClientBasedCulture
totrue
in globalization ?