HighTechTalks DotNet Forums  

Satellites not found for manually loaded assemblies

Dotnet Internationalization microsoft.public.dotnet.internationalization


Discuss Satellites not found for manually loaded assemblies in the Dotnet Internationalization forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jan
 
Posts: n/a

Default Satellites not found for manually loaded assemblies - 09-07-2006 , 12:28 AM






Hi,
my application loads assemblies with sub features by Assembly.LoadFrom,
depending on what features user chooses to run.

Each assembly needs to be localized. I'm using satellite resource assemblies
in subfolders. But the satellites are not found by program and defaults are
used. FUSLOGVW shows that they are searched only in appbase and private path
of the main application but the sub assemblies are not directly there.

Is it somehow possible to use the standard resource lookup in this way or do
I have to load also resource assemblies with Assembly.LoadFrom and forget
help of framework ?
I don't want to modify .config of the main application, nothing is known
about the sub assemblies in advance.

Thanks,
Jan

Reply With Quote
  #2  
Old   
Aldo Donetti [MS]
 
Posts: n/a

Default RE: Satellites not found for manually loaded assemblies - 10-12-2006 , 06:07 PM






Hi Jan,
I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
LoadFrom and might be the reason why the sub features' resources are not loaded.

thanks,
Aldo


-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
Quote:
Thread-Topic: Satellites not found for manually loaded assemblies
thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
X-WBNR-Posting-Host: 81.27.194.73
From: =?Utf-8?B?SmFu?= <Jan (AT) discussions (DOT) microsoft.com
Subject: Satellites not found for manually loaded assemblies
Date: Wed, 6 Sep 2006 21:28:01 -0700
Lines: 17
Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.dotnet.internationalization
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.dotnet.internationalization

Hi,
my application loads assemblies with sub features by Assembly.LoadFrom,
depending on what features user chooses to run.

Each assembly needs to be localized. I'm using satellite resource assemblies
in subfolders. But the satellites are not found by program and defaults are
used. FUSLOGVW shows that they are searched only in appbase and private path
of the main application but the sub assemblies are not directly there.

Is it somehow possible to use the standard resource lookup in this way or do
I have to load also resource assemblies with Assembly.LoadFrom and forget
help of framework ?
I don't want to modify .config of the main application, nothing is known
about the sub assemblies in advance.

Thanks,
Jan




Reply With Quote
  #3  
Old   
Aldo Donetti [MS]
 
Posts: n/a

Default RE: Satellites not found for manually loaded assemblies - 10-12-2006 , 06:34 PM



Hi again Jan,
during a second test I have noticed that the assembly that you load with LoadFrom is actually getting the same Thread.CurrentThread.CurrentUICulture object as the main application and it's loading resources
appropriately. So I'm not sure what's happening in your case.

From the main assembly I have invoked the sub DLL as follows

Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");

Assembly c = Assembly.LoadFrom(@"C:\Test\D\D\bin\Debug\D.dll");
Object o = c.CreateInstance("D.Class1", true);
MethodInfo m = c.GetType("D.Class1").GetMethods()[0];
Object o2 = m.Invoke(o,null);

the main assembly is in a different location than the sub DLL and they both load their appropriate resources from their respective locations (the sub DLL loads its Italian resources)

Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
Quote:
X-Tomcat-ID: 548411376
References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: aldod (AT) online (DOT) microsoft.com ("Aldo Donetti [MS]")
Organization: Microsoft
Date: Thu, 12 Oct 2006 22:07:59 GMT
Subject: RE: Satellites not found for manually loaded assemblies
X-Tomcat-NG: microsoft.public.dotnet.internationalization
Message-ID: <olaDirk7GHA.4348 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
Newsgroups: microsoft.public.dotnet.internationalization
Lines: 59
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2518
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Hi Jan,
I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
LoadFrom and might be the reason why the sub features' resources are not loaded.

thanks,
Aldo


-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| Thread-Topic: Satellites not found for manually loaded assemblies
| thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| X-WBNR-Posting-Host: 81.27.194.73
| From: =?Utf-8?B?SmFu?= <Jan (AT) discussions (DOT) microsoft.com
| Subject: Satellites not found for manually loaded assemblies
| Date: Wed, 6 Sep 2006 21:28:01 -0700
| Lines: 17
| Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Newsgroups: microsoft.public.dotnet.internationalization
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
| NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
|
| Hi,
| my application loads assemblies with sub features by Assembly.LoadFrom,
| depending on what features user chooses to run.
|
| Each assembly needs to be localized. I'm using satellite resource assemblies
| in subfolders. But the satellites are not found by program and defaults are
| used. FUSLOGVW shows that they are searched only in appbase and private path
| of the main application but the sub assemblies are not directly there.
|
| Is it somehow possible to use the standard resource lookup in this way or do
| I have to load also resource assemblies with Assembly.LoadFrom and forget
| help of framework ?
| I don't want to modify .config of the main application, nothing is known
| about the sub assemblies in advance.
|
| Thanks,
| Jan
|






Reply With Quote
  #4  
Old   
Jan
 
Posts: n/a

Default RE: Satellites not found for manually loaded assemblies - 10-13-2006 , 06:21 AM



Hi Aldo,
thanks for answer.

I need to read localized strings. The dll project contains embedded
resource.resx with English texts and resource.cs.resx with Czech ones. Build
creates localized *.resources.dll in subfolder "cs".

I try to load strings in the program like this:
System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo("cs");
System.Resources.ResourceManager resourceManager = new
System.Resources.ResourceManager("namespace.resour ce",
this.GetType().Assembly);
string txt = resourceManager.GetString("stringID");

FUSLOGVW shows that the resource manager searches for the cs resource dll in
subforlers of the main application, not at the dll location.

Should I do it in different way ?

Regards,
Jan

""Aldo Donetti [MS]"" wrote:

Quote:
Hi again Jan,
during a second test I have noticed that the assembly that you load with LoadFrom is actually getting the same Thread.CurrentThread.CurrentUICulture object as the main application and it's loading resources
appropriately. So I'm not sure what's happening in your case.

From the main assembly I have invoked the sub DLL as follows

Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");

Assembly c = Assembly.LoadFrom(@"C:\Test\D\D\bin\Debug\D.dll");
Object o = c.CreateInstance("D.Class1", true);
MethodInfo m = c.GetType("D.Class1").GetMethods()[0];
Object o2 = m.Invoke(o,null);

the main assembly is in a different location than the sub DLL and they both load their appropriate resources from their respective locations (the sub DLL loads its Italian resources)

Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| X-Tomcat-ID: 548411376
| References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: aldod (AT) online (DOT) microsoft.com ("Aldo Donetti [MS]")
| Organization: Microsoft
| Date: Thu, 12 Oct 2006 22:07:59 GMT
| Subject: RE: Satellites not found for manually loaded assemblies
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
| Message-ID: <olaDirk7GHA.4348 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Newsgroups: microsoft.public.dotnet.internationalization
| Lines: 59
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2518
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Jan,
| I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
| Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
| LoadFrom and might be the reason why the sub features' resources are not loaded.
|
| thanks,
| Aldo
|
|
| -- This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
| --------------------
| | Thread-Topic: Satellites not found for manually loaded assemblies
| | thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| | X-WBNR-Posting-Host: 81.27.194.73
| | From: =?Utf-8?B?SmFu?= <Jan (AT) discussions (DOT) microsoft.com
| | Subject: Satellites not found for manually loaded assemblies
| | Date: Wed, 6 Sep 2006 21:28:01 -0700
| | Lines: 17
| | Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Newsgroups: microsoft.public.dotnet.internationalization
| | Path: TK2MSFTNGXA01.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
| | NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| | X-Tomcat-NG: microsoft.public.dotnet.internationalization
| |
| | Hi,
| | my application loads assemblies with sub features by Assembly.LoadFrom,
| | depending on what features user chooses to run.
| |
| | Each assembly needs to be localized. I'm using satellite resource assemblies
| | in subfolders. But the satellites are not found by program and defaults are
| | used. FUSLOGVW shows that they are searched only in appbase and private path
| | of the main application but the sub assemblies are not directly there.
| |
| | Is it somehow possible to use the standard resource lookup in this way or do
| | I have to load also resource assemblies with Assembly.LoadFrom and forget
| | help of framework ?
| | I don't want to modify .config of the main application, nothing is known
| | about the sub assemblies in advance.
| |
| | Thanks,
| | Jan
| |
|
|
|




Reply With Quote
  #5  
Old   
Aldo Donetti [MS]
 
Posts: n/a

Default RE: Satellites not found for manually loaded assemblies - 11-08-2006 , 10:25 PM



Sorry for the delay Jan - you must have figured it out by now, but if not, you can manually load resources by either:

1. manually locate and load the DLL with LoadFrom, then use a resourceManager on that, as in
string p = Application.StartupPath;
Assembly c = Assembly.LoadFrom(p + @"\cs\LoadResourcesManually.resources.dll");
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("LoadResourcesMan ually.Form1.cs", c);
string txt = rm.GetString("label1.Text");
note that in this case you don't need to set a UICulture because you're loading the DLL containing resources manually

2. do what the Windows Forms' code-behind does and use the ComponentResourceManager
System.Threading.Thread.CurrentThread.CurrentUICul ture = new System.Globalization.CultureInfo("cs");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typ eof(Form1));
string txt = resources.GetString("label1.Text");

3. use the "old" way
System.Threading.Thread.CurrentThread.CurrentUICul ture = new System.Globalization.CultureInfo("cs");
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Form1));
string txt = rm.GetString("label1.Text");

HTH
Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
Quote:
Thread-Topic: Satellites not found for manually loaded assemblies
thread-index: AcbusUhsYyfUXZiBTqux93bt0FnAOQ==
X-WBNR-Posting-Host: 212.111.31.254
From: =?Utf-8?B?SmFu?= <Jan (AT) discussions (DOT) microsoft.com
References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com> <olaDirk7GHA.4348 (AT) TK2MSFTNGXA01 (DOT) phx.gbl> <pwyWP6k7GHA.4348 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
Subject: RE: Satellites not found for manually loaded assemblies
Date: Fri, 13 Oct 2006 03:21:01 -0700
Lines: 123
Message-ID: <A3934409-0993-4158-9611-68630E7FBA21 (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.dotnet.internationalization
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2523
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.dotnet.internationalization

Hi Aldo,
thanks for answer.

I need to read localized strings. The dll project contains embedded
resource.resx with English texts and resource.cs.resx with Czech ones. Build
creates localized *.resources.dll in subfolder "cs".

I try to load strings in the program like this:
System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo("cs");
System.Resources.ResourceManager resourceManager = new
System.Resources.ResourceManager("namespace.resour ce",
this.GetType().Assembly);
string txt = resourceManager.GetString("stringID");

FUSLOGVW shows that the resource manager searches for the cs resource dll in
subforlers of the main application, not at the dll location.

Should I do it in different way ?

Regards,
Jan

""Aldo Donetti [MS]"" wrote:

Hi again Jan,
during a second test I have noticed that the assembly that you load with LoadFrom is actually getting the same Thread.CurrentThread.CurrentUICulture object as the main application and it's loading resources
appropriately. So I'm not sure what's happening in your case.

From the main assembly I have invoked the sub DLL as follows

Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");

Assembly c = Assembly.LoadFrom(@"C:\Test\D\D\bin\Debug\D.dll");
Object o = c.CreateInstance("D.Class1", true);
MethodInfo m = c.GetType("D.Class1").GetMethods()[0];
Object o2 = m.Invoke(o,null);

the main assembly is in a different location than the sub DLL and they both load their appropriate resources from their respective locations (the sub DLL loads its Italian resources)

Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| X-Tomcat-ID: 548411376
| References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: aldod (AT) online (DOT) microsoft.com ("Aldo Donetti [MS]")
| Organization: Microsoft
| Date: Thu, 12 Oct 2006 22:07:59 GMT
| Subject: RE: Satellites not found for manually loaded assemblies
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
| Message-ID: <olaDirk7GHA.4348 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Newsgroups: microsoft.public.dotnet.internationalization
| Lines: 59
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2518
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Jan,
| I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
| Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
| LoadFrom and might be the reason why the sub features' resources are not loaded.
|
| thanks,
| Aldo
|
|
| -- This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
| --------------------
| | Thread-Topic: Satellites not found for manually loaded assemblies
| | thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| | X-WBNR-Posting-Host: 81.27.194.73
| | From: =?Utf-8?B?SmFu?= <Jan (AT) discussions (DOT) microsoft.com
| | Subject: Satellites not found for manually loaded assemblies
| | Date: Wed, 6 Sep 2006 21:28:01 -0700
| | Lines: 17
| | Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B (AT) microsoft (DOT) com
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Newsgroups: microsoft.public.dotnet.internationalization
| | Path: TK2MSFTNGXA01.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
| | NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| | X-Tomcat-NG: microsoft.public.dotnet.internationalization
| |
| | Hi,
| | my application loads assemblies with sub features by Assembly.LoadFrom,
| | depending on what features user chooses to run.
| |
| | Each assembly needs to be localized. I'm using satellite resource assemblies
| | in subfolders. But the satellites are not found by program and defaults are
| | used. FUSLOGVW shows that they are searched only in appbase and private path
| | of the main application but the sub assemblies are not directly there.
| |
| | Is it somehow possible to use the standard resource lookup in this way or do
| | I have to load also resource assemblies with Assembly.LoadFrom and forget
| | help of framework ?
| | I don't want to modify .config of the main application, nothing is known
| | about the sub assemblies in advance.
| |
| | Thanks,
| | Jan
| |
|
|
|







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.