By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,273 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,273 IT Pros & Developers. It's quick & easy.

loading strings

P: n/a
Hello,

Got strings.resx included in my assmebly as the default language neutral
collection.

ResourceManager res=new ResourceManager("strings",
Assembly.GetExecutingAssembly());

string test=res.GetString("TestString");

TestString exists in the resource file. The compiler message window
seems to indicate thsat the strings are compiled and included in the
assembly but I'm getting unhandled exception
System.Resources.MissingManifestResourceException

Could not find any resources appropriate for the specified culture in
the given assembly. Make sure "strings.resources" was correctly linked
or embedded into assembly.

Help!!!
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil Da Lick!" <ph***********@NOSPAMhotmail.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
Hello,

Got strings.resx included in my assmebly as the default language neutral
collection.

ResourceManager res=new ResourceManager("strings",
Assembly.GetExecutingAssembly());

string test=res.GetString("TestString");

TestString exists in the resource file. The compiler message window seems
to indicate thsat the strings are compiled and included in the assembly
but I'm getting unhandled exception
System.Resources.MissingManifestResourceException

Could not find any resources appropriate for the specified culture in the
given assembly. Make sure "strings.resources" was correctly linked or
embedded into assembly.

Help!!!

Nov 17 '05 #2

P: n/a
Kai Brinkmann [MSFT] wrote:
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.


what resource file? does it not work the same way as VC++ where the
resources are compiled into the assembly? I've just added the resources
in a resx to the assembly in the prroject view.
Nov 17 '05 #3

P: n/a
Yes, the base resources are compiled into the assembly. All language
resource files end up in satellite assemblies. If you're using VS, this will
be done automatically as long as you observe the proper naming conventions.

For example, let's assume you created a resource file AppResources.resx in
your project and your namespace is MyNamespace.MyApp.
In this case, the ctor for your ResourceManager should look like this:

ResourceManager rm = new ResourceManager("MyNamespace.MyApp.AppResources",
Assembly.GetExecutingAssembly());

Note the fully qualified resource name!

AppResources.resx is compiled to AppResources.resources (you can do this
manually using resgen) and embedded in your core assembly (MyApp.exe). You
can create localized resource files like this:

AppResources.fr-FR.resx // French (France) resources
AppResources.de-DE.resx // German (Germany) resources
AppResources.ja-JP.resx // Japanese (Japan) resources

These resources will also be compiled to their appropriate resources files
and embedded in satellite assemblies named MyApp.resources.dll. These
assemblies will end up in directories named after the culture (fr-FR, de-DE,
ja-JP) underneath your main application directory. At run-time, the resource
manager will attempt to find appropriate resources for the selected
CurrentUICulture. There is a fallback mechanism if no resources can be
found, and as a last resort the resources embedded in the main assembly will
be used (i.e. the resources in the base resource file AppResources.resx).

I hope this helps.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil Da Lick!" <ph***********@NOSPAMhotmail.com> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Kai Brinkmann [MSFT] wrote:
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.


what resource file? does it not work the same way as VC++ where the
resources are compiled into the assembly? I've just added the resources in
a resx to the assembly in the prroject view.

Nov 17 '05 #4

P: n/a
Kai Brinkmann [MSFT] wrote:
Yes, the base resources are compiled into the assembly. All language
resource files end up in satellite assemblies. If you're using VS, this will
be done automatically as long as you observe the proper naming conventions.

For example, let's assume you created a resource file AppResources.resx in
your project and your namespace is MyNamespace.MyApp.
In this case, the ctor for your ResourceManager should look like this:

ResourceManager rm = new ResourceManager("MyNamespace.MyApp.AppResources",
Assembly.GetExecutingAssembly());

Note the fully qualified resource name!
Just what I needed, thanks.

AppResources.resx is compiled to AppResources.resources (you can do this
manually using resgen) and embedded in your core assembly (MyApp.exe). You
can create localized resource files like this:

AppResources.fr-FR.resx // French (France) resources
AppResources.de-DE.resx // German (Germany) resources
AppResources.ja-JP.resx // Japanese (Japan) resources


So can I also just include these into the assembly in the project view
and VS will take care of them automatically?
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.