Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 572911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:40:07+00:00 2026-05-13T13:40:07+00:00

I have multiple projects that need to share resource files (.resx) Suggestions have been

  • 0

I have multiple projects that need to share resource files (.resx) Suggestions have been made to move resource files to a separate assembly and have web projects reference it. Is there an example of how to do this?

Do I create a new Class Library project and move App_GlobalResource folder inside of that? I don’t think that will work because code classes that are generated for resource files are marked as ‘internal’ which means that they can not be accessed outside of this assembly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:40:07+00:00Added an answer on May 13, 2026 at 1:40 pm

    In the properties window of Visual Studio, you should be able to set the access modifier of the resource file to public. You won’t, however, be able to access the resources in aspx files using the normal <%$ Resources:... %> syntax, since it does not support resources in referenced assemblies. I had the same problem and solved it by implementing a custom ExpressionBuilder, but I don’t have access to my source code at the moment. If it’s still needed then, I can look up the code tonight.


    EDIT: OK, here’s how I solved that problem:

    Step 1: Move the resx files into the class library. They do not need to be in a specific folder. In the visual designer of the resx file, set the “Access Modifier” (upper right-hand corner) to “Public”

    You should now be able to

    • reference the resources in C#/VB code (in the library as well as in the web project), e.g., Dim myMessage As String = [Namespace.]Resources.NameOfResx.NameOfResource

    • reference the resource as inline code in aspx pages, e.g., <h1><%= [Namespace.]Resources.NameOfResx.MyTitle %></h1>.

    What won’t work at this point is to use Resources expression, e.g., <asp:Button runat="server" Text="<%$ Resources:NameOfResx,MyButtonText %>" />. Unfortunately, you cannot simply replace this with inline code, since it’s inside the property of a server side control.

    Step 2: Let’s make a custom ExpressionBuilder in our library, which interprets arbitrary code expressions. Fortunately, we can let the powerful classes of the .net Framework do all the work for us:

    Imports System.Web.Compilation
    Imports System.Resources
    Imports System.CodeDom
    
    <ExpressionPrefix("Code")> _
    Public Class CodeExpressionBuilder
        Inherits ExpressionBuilder
    
        Public Overrides Function GetCodeExpression(ByVal entry As System.Web.UI.BoundPropertyEntry, ByVal parsedData As Object, ByVal context As System.Web.Compilation.ExpressionBuilderContext) As System.CodeDom.CodeExpression
            Return New CodeSnippetExpression(entry.Expression)
        End Function
    End Class
    

    Then we need to register this ExpressionBuilder in the web.config:

    <system.web>
      ...
      <compilation ...>
        <expressionBuilders>
          <add expressionPrefix="Code" type="NamespaceOfYourLibrary.CodeExpressionBuilder" />
        </expressionBuilders>
      </compilation>
    </system.web>
    

    Now you should be able to do the following:

    <asp:Button runat="server" Text="<%$ Code:[Namespace.]Resources.NameOfResx.MyButtonText %>" />
    

    Credit: I got the idea for the CodeExpressionBuilder from the Infinites Loop blog. If you’re more into C# than VB, you can have a look at the code examples there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many times I have seen Visual Studio solutions which have multiple projects that share
I have a large Java app that is split up into multiple projects. Each
I have a solution with multiple projects and we need to do some serious
At work we have a number of projects which need to share some common
We have a solution with multiple web projects, and there are some pages that
I have a few user controls that need to be shared between multiple Silverlight
I have a project where there are multiple applications that have some common configuration
I have multiple projects in a couple of different workspaces. However, it seems like
We have multiple vb projects.We want to put error handlers in all functions, and
Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.