A problem with resources file.

  • Thread starter Stefan Turalski \(stic\)
  • Start date
S

Stefan Turalski \(stic\)

Hi,

What I need to do is adding some support for resources files to my
application. What I did is:
MyAppMain <- startup project
MyAppHelper <- project which has MyAppResourcesClass (al a library project)
This class call methode :
ResourceManager MyAppResourceManager = new
ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly());
and I obtain error which tell that there is no propertly added
MyAppMainResources resource file / collection to this MyAppHelper set.

What I did, is to add resources file to MyAppMain project (I thought adding
file Resources.resx to this project will be enought), but no... so I go
further to making file Resource.resources.dll by resgen & al utilities, then
I tray to set /embed:Resources.resources,MyAppMain.Resources.resources, and
for embed:Resources.resources,MyAppHelper.Resources.resources - for the
second setting I reedit ResourceManager("MyAppHelper.Resources) ... and I
did a lot of these things. All with culture set to

private static CultureInfo QServiceCultureInfo = new CultureInfo(""), which
should give me invariant culture or call embedded resources (?). I try to
set culture to en-GB and make files in en-GB folder (these dll's) and then
call them form the MyAppMain ("MyAppMain.Resources) and ResourceManager
created there is working perfectly (oposite, I still cant put one
Resources.resx in project and forget about it.

So what I should do to obtain situation when I still have one resource file
embeded in my project, which should be accessable by Helper class ? How the
ResourceManager should be inicialized ?
 
S

Stefan Turalski \(stic\)

U¿ytkownik "Stefan Turalski (stic) said:
Hi,

What I need to do is adding some support for resources files to my
application. What I did is:
MyAppMain <- startup project
MyAppHelper <- project which has MyAppResourcesClass (al a library project)
This class call methode :
ResourceManager MyAppResourceManager = new
ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly());
and I obtain error which tell that there is no propertly added
MyAppMainResources resource file / collection to this MyAppHelper set.

What I did, is to add resources file to MyAppMain project (I thought adding
file Resources.resx to this project will be enought), but no... so I go
further to making file Resource.resources.dll by resgen & al utilities, then
I tray to set /embed:Resources.resources,MyAppMain.Resources.resources, and
for embed:Resources.resources,MyAppHelper.Resources.resources - for the
second setting I reedit ResourceManager("MyAppHelper.Resources) ... and I
did a lot of these things. All with culture set to

private static CultureInfo QServiceCultureInfo = new CultureInfo(""), which
should give me invariant culture or call embedded resources (?). I try to
set culture to en-GB and make files in en-GB folder (these dll's) and then
call them form the MyAppMain ("MyAppMain.Resources) and ResourceManager
created there is working perfectly (oposite, I still cant put one
Resources.resx in project and forget about it.

So what I should do to obtain situation when I still have one resource file
embeded in my project, which should be accessable by Helper class ? How the
ResourceManager should be inicialized ?

--

best regards

stic

Ok, what I have done is:
1. Make this resource file in another location (not added to project)
2. by resgen I obtain for example en-GB Resource.en-GB.resources form
Resources.en-GB.resx
3. by al, I embeded this to dll,
al /t:lib
/embed:Resources.en-GB.reources,MyNamespace.MyAppHelper.Resources.en-GB.reso
urce /culture:en-GB /out:Resources.resources.dll
4. I put this file to a new childe folder en-GB, in folder of my debug
folder
5. in ResourceManager, i gave as a parametr
"MyNamespace.MyAppHelper.Resources", and for every for exmaple GetString I
use CultureInfo("en-GB");

and this works ;-)

What is gave me fun - it will be also work if I set culture for (for
example) de-DE, or for "" - strange things - today I'm not going to try
adding another resource file for other culture and conect this files for
specific CultureInfo but I'm ready for next hard questions...

If anybody could told me which step I should do (and I jumped over) please -
it coulde be so hard to deploy multi-resources applications..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top