Resource expression to access resource located in library

Discussion in 'ASP .Net' started by Heinrich Moser, Mar 11, 2008.

  1. 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
     
    Heinrich Moser, Mar 11, 2008
    #1
    1. Advertising

  2. Hi!

    Heinrich Moser <> writes:
    > 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
     
    Heinrich Moser, Mar 27, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Hnatt
    Replies:
    6
    Views:
    477
    Mike Hnatt
    Oct 23, 2003
  2. Kristoffer Arfvidson
    Replies:
    7
    Views:
    596
    Shiv Kumar
    Jan 21, 2004
  3. Kevin Spencer
    Replies:
    0
    Views:
    344
    Kevin Spencer
    May 21, 2004
  4. Jason Kendall
    Replies:
    2
    Views:
    3,100
    Jason Kendall
    Feb 4, 2005
  5. nobody
    Replies:
    1
    Views:
    537
    Venkatesh
    Apr 26, 2006
Loading...

Share This Page