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

  • SEARCH
  • Home
  • 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 931433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:30:02+00:00 2026-05-15T20:30:02+00:00

I am trying to get the localization for my MVC project working with our

  • 0

I am trying to get the localization for my MVC project working with our existing infrastructure for editing string resources. We store all our resource string in database tables and have a front end web UI to edit them with, and an export application which generated the .resx files. This all works great, but I am having a little difficulty with a new project using MVC2 and VS2010.

I have asked another question on this, the answer to which almost got me there, but not quite.

I have now changed the resources to be in a Resources folder (instead of App_GlobalResources), as recommended by a number of people. And have the following settings against my .resx files …

Build Action             = Embedded Resource
Copy to Output Directory = Do not copy
Custom Tool              = PublicResXFileCodeGenerator
Custom Tool Namespace    = Resources
File Name                = MyApp.resx

I have changed my export application to run the resgen.exe tool with the following parameters …

string args = string.Format("/publicClass \"{0}\" /str:cs,Resources,{1},\"{2}\"", resourceFile, Path.GetFileNameWithoutExtension(resourceFile), csFilename);

… which generates an almost identical .designer.cs file as I get when I add the .resx file to my project initially. The only difference is the

The generated .designer.cs file differs slightly from the file I get when I run the resgen.exe tool from within my export application.

This is the code generated by VS2010 when I first add the .resx file to my Resources folder …

public static global::System.Resources.ResourceManager ResourceManager {
    get {
        if (object.ReferenceEquals(resourceMan, null)) {
            global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.MyApp", typeof(MyApp).Assembly);
            resourceMan = temp;
        }
        return resourceMan;
    }
}

… the difference when I run the resgen.exe tool is that is prefixs MyCompany.MyApp to the namespace in the constructor to ResourceManager

new global::System.Resources.ResourceManager("MyCompany.MyApp.Resources.MyApp", typeof(MyApp).Assembly);

Now, this to me seems to be a bug in the resgen.exe tool, because I’ve told it that the Namespace for my resources is Resources, not MyCompany.MyApp.Resources.

So, is there a fix/work-around for this problem?

The only thing I can think to do at the moment is to post-process the generated .designer.cs file with powershell and fix it!

  • 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-15T20:30:02+00:00Added an answer on May 15, 2026 at 8:30 pm

    Finally, I have solved the problem.

    I decided to simplify things a bit by breaking my resources out in to a new assembly called Resources. I then added my resx files and set the properties for them as below …

    Build Action             = Embedded Resource
    Copy to Output Directory = Do not copy
    Custom Tool              = PublicResXFileCodeGenerator
    Custom Tool Namespace    = Resources
    File Name                = MyApp.resx
    

    I then changed my export application to run …

    resgen MyApp.resx /str:c#,Resources,MyApp,MyApp.designer.cs /publicClass
    

    … and to delete *.resources from the folder (created by the resgen.exe utility, but not needed)

    This got rid of the prefix on the constructor to ResourceManager, and then i just added a reference to my new Resources assembly to my web application.

    I’ve run a few tests to make sure all is good, including going in to the .designer.cs file and deleting one of the properties to cause a compiler error. Then re-ran my export app, and everything worked again.

    So, I am a happy bunny!

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

Sidebar

Related Questions

Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Hello everyone I been trying get php uploader working but having a lot of
I'm trying get all of the current stack frames and do some inspection on
I'm trying to get this working but no success: <asp:Repeater ID=Repeater1 runat=server OnItemCommand=btnDeleteFamily_Click> <HeaderTemplate>
Im trying get all my maingroups with its related entities. And i would also
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I am trying get my first simple project in rails to run. I have
I'm having a problem trying to get working those 2 plugins together: Localisation (for
Trying to get MVC running on Mono 2.4 (which is possible, according to some
i am trying to get i18n localisation working on an Grails/Groovy enum, public enum

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.