Resource expression to access resource located in library

H

Heinrich Moser

Hi!

(This posting refers to Visual Studio 2008.)

I'm moving part of my asp.net application into a library, to be able
to reuse that (server control) code for other projects. This also
includes some localized text resources. These resources need to be
usable by the library as well as by ASP.NET projects using that
library.

First problem: The auto-generated class for the resx in the library
(ShopTexte.resx) is Friend/interal instead of public. I know that
there are third-party-ResXFileCodeGenerator-replacements out there
that fix this, but I'd prefer a solution without Visual Studio plugins
because it makes life easier for my co-developers.

So I thought I'd make a proxy class in the library project for the few
resources that need to be shared:

Namespace Resources
Public Class ShopTexteProxy
Public Shared ReadOnly Property Warenkorb() As String
Get
Return ShopTexte.Warenkorb
End Get
End Property
... other resources ...
End Class
End Namespace

This works fine from code, but I cannot access this resource from an
aspx page. Neither

<asp:Localize Runat="server" Text="<%$ Resources:ShopTexte, Warenkorb %>" />

nor

<asp:Localize Runat="server" Text="<%$ Resources:ShopTexteProxy, Warenkorb %>" />

works. Of course, resx files residing in the asp.net project work
fine. How can I access my resx files residing in the library using
resource expressions? Or am I doing something conceptually wrong?

(The library and the asp.net project both use the same root namespace,
so it shouldn't be a namespace issue.)

Greetings,
Heinzi
 
H

Heinrich Moser

Hi!

Heinrich Moser said:
I'm moving part of my asp.net application into a library, to be able
to reuse that (server control) code for other projects. This also
includes some localized text resources. These resources need to be
usable by the library as well as by ASP.NET projects using that
library.

First problem: The auto-generated class for the resx in the library
(ShopTexte.resx) is Friend/interal instead of public. I know that
there are third-party-ResXFileCodeGenerator-replacements out there
that fix this, but I'd prefer a solution without Visual Studio plugins
because it makes life easier for my co-developers.

So I thought I'd make a proxy class in the library project for the few
resources that need to be shared:

In the mean time, I discovered that this is no longer necessary in
Visual Studio 2008, since you can change the access modifier (Friend
or Public) in the resource editor.

Still, the question remains: How can I use a resource expression with
a resource file located in a referenced library, i.e. how can I do

<asp:Localize Runat="server" Text="<%$ Resources:ResourceFileInLibrary, SomeName %>" />

Greetings,
Heinzi
 

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

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top