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
(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