Microsoft Developer Network >
포럼 홈
>
Windows Presentation Foundation (WPF)
>
resources in satellite assembly causes exception
resources in satellite assembly causes exception
- <!--DIV {margin:0px;}-->I have a simple wpf application.
The project file contains "<UICulture>en-US</UICulture>".
AssemblyInfo.cs contains
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
Resources.resx uses the Custom Tool
PublicResXFileCodeGenerator
There is a single string resource named ButtonText.
I signed the assembly.
The following line generates an error.
string str = Properties.Resources.ButtonText;
The message is:
Message="Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"WpfLocTest.Properties.Resources.en-US.resources\" was correctly embedded or linked into assembly \"WpfLocTest\" at compile time, or that all the satellite assemblies required are loadable and fully signed."
Does anyone see a solution?
Bill
답변
- I hadn't found that walkthrough. It showed me what I needed to know. Thanks.
Bill- 답변으로 표시됨Bill Swartz 2009년 7월 3일 금요일 오후 3:33
모든 응답
It seems like you're trying to mix the idea of Satellite resources and resources that are compiled into the assembly. My guess is that you were following the walkthrough here:
http://msdn.microsoft.com/en-us/library/cc668131.aspx
And you finished it, but it still doesn't work right. Based on what you're telling me, it seems like you left a couple of steps out.
Things to make sure of:
1. The Resources.resx shouldn't be using the custom tool.
2. Resources.resx should be named Resources.en-US.resx.
3. The call to get the resource should be more like:
ResourceManager rm = new ResourceManager(
"WpfLocTest.Properties.Resources",
Assembly.GetExecutingAssembly());
MessageBox.Show(rm.GetString("ButtonText"));
David Morton - http://blog.davemorton.net/ - @davidmmorton - ForumsBrowser, a WPF MSDN Forums Client- You can try two more things:
1: right click on your resources.resx file. Goto properties and provide the CustomToolNamespace as WPFLocTest.Properties
2: Also make sure that you have made all the resources as public. By default they are internal.
Hope it helps.
Cheers,
Tarun
Developer - I hadn't found that walkthrough. It showed me what I needed to know. Thanks.
Bill- 답변으로 표시됨Bill Swartz 2009년 7월 3일 금요일 오후 3:33
- Bill,
If it was one of our posts that led you to the answer, it would be nice if you could mark our posts as the answer, and not your own. The answer posts show up at the top of the list now, so marking the proper post as answer will greatly help anyone else who sees this thread to quickly find the answer.
David Morton - http://blog.davemorton.net/ - @davidmmorton - ForumsBrowser, a WPF MSDN Forums Client

