Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

resx in dll

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alexander Widera - 01 Aug 2007 18:52 GMT
Hi,

i am developing a website and a dll .... in the App_GlobalResources
directory are some .resx-files.... which filename i know.
I want to use them in a dll which is in the bin-directory?

how can i do that?

thanks,
alex
Peter Bucher [MVP] - 01 Aug 2007 20:38 GMT
Hi Alexander

> i am developing a website and a dll .... in the App_GlobalResources
> directory are some .resx-files.... which filename i know.
> I want to use them in a dll which is in the bin-directory?
>
> how can i do that?
Mark "Build Action" in the Properties of the resx file to "Embedded
Resource".
You can seee a screenshoot of the propertie window here:
- http://aspnet.4guysfromrolla.com/articles/080906-1.aspx

Signature

Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

Jesse Houwing - 01 Aug 2007 21:28 GMT
Hello Peter Bucher [MVP],

> Hi Alexander
>
[quoted text clipped - 7 lines]
> You can seee a screenshoot of the propertie window here:
> - http://aspnet.4guysfromrolla.com/articles/080906-1.aspx

I think what he's trying to do is to use the resources in the website project
in a project that is referenced by the website project.

So basically with a solution liek this:

+ solution
|- Project1
|- Website
  |- References
  |  |- Project1
  |- App_GlobalResources
      |- Resource.Resx

And now he wants to access the resources in App_GlobalResources from sources
inside Project1.

The official word on this is that it cannot be done.

My guess is that using some creativity in the way you instantiate your resourcemanager
woudl actually get it to work, but I cannot guarantee that it will stay that
way.

The ResourceManager constructor get's an Assembly and a Resource name. For
the assembly try using Assebly.GetExecutingAssembly which with a bit of luck
resolves to the assembly in which the resource file was compiled. As name
for the resource... I'm not sure what the full name will be. You could try
using Lutz Roeder's Reflector to see how the compiler actually named it.
I'd guess something like 'WebSiteProjectsName.App_GlaobalResources.Resource.Resx.recource'.

From there you can use the GetString method of the Resource Manager to access
strings in the resource file.

A better solution would be to add a project to your solution which contains
the resources. Then use those resources from both the project and the website.

+ solution
|- ResourceProject
|  |- Resource.Resx
|- Project1
|  |- References
|  |  |- ResourceProject
|- Website
  |- References
  |  |- Project1
  |  |- ResourceProject
  |- App_GlobalResources

Jesse
Jesse Houwing - 01 Aug 2007 21:38 GMT
Hello Peter Bucher [MVP],

> Hi Alexander
>
[quoted text clipped - 7 lines]
> You can seee a screenshoot of the propertie window here:
> - http://aspnet.4guysfromrolla.com/articles/080906-1.aspx

I think what he's trying to do is to use the resources in the website project
in a project that is referenced by the website project.

So basically with a solution like this:

+ solution
|- Project1
|- Website
|- References
| |- Project1
|- App_GlobalResources
|- Resource.Resx

And now he wants to access the resources in App_GlobalResources from sources
inside Project1.

The official word on this is that it cannot be done.

My guess is that using some creativity in the way you instantiate your resourcemanager
woudl actually get it to work, but I cannot guarantee that it will stay that
way.

The ResourceManager constructor get's an Assembly and a Resource name. For
the assembly try using Assebly.GetExecutingAssembly which with a bit of luck
resolves to the assembly in which the resource file was compiled. As name
for the resource... I'm not sure what the full name will be. You could try
using Lutz Roeder's Reflector to see how the compiler actually named it.
I'd guess something like 'WebSiteProjectsName.App_GlaobalResources.Resource.Resx.recource'.

From there you can use the GetString method of the Resource Manager to access
strings in the resource file.

A better solution would be to add a project to your solution which contains
the resources. Then use those resources from both the project and the website.

+ solution
|- ResourceProject
| |- Resource.Resx
[quoted text clipped - 6 lines]
| |- ResourceProject
|- App_GlobalResources

Jesse

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.