The namespace 'Resources' already contains a definition for

Last post 06-19-2009 1:37 PM by TheDonSansone. 11 replies.

Sort Posts:

  • The namespace 'Resources' already contains a definition for

    01-17-2008, 5:04 AM
    • Member
      48 point Member
    • satishambition
    • Member since 09-03-2007, 10:40 AM
    • Pune
    • Posts 18

    Hi,

     I am working with .net2.0 Resource Files(Resx).
     after coping the Colture specific file in the App_GlobalResources and compiling I got the following error message.
     
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0101: The namespace 'Resources' already contains a definition for 'CommonMessages'

    Source Error:

    Line 24:     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    Line 25:     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    Line 26:     public class CommonMessages {
    Line 27:        
    Line 28:         private static global::System.Resources.ResourceManager resourceMan;
     
    I don't know why it happens?

     

  • Re: The namespace 'Resources' already contains a definition for

    01-17-2008, 9:56 AM
    • Star
      14,584 point Star
    • david wendelken
    • Member since 07-27-2005, 11:47 PM
    • Fayetteville, NC, USA
    • Posts 2,076
    • Moderator

    I'm guessing you have two entries in the same resource file with the key of CommonMessages.

    If this answered your question, be sure to mark it as the answer. That way, everybody after you will know it's the answer also!
  • Re: The namespace 'Resources' already contains a definition for

    01-17-2008, 9:56 AM

    Hi,

    Welcome to the ASP.NET forums.

    How many resx files do you have in your App_Global folder? If you have more than one resx file in your App_Global, try renaming the other one (to let us say Resource.resx_old).

    See if that solves your problems

     

    HTH,
    Suprotim Agarwal

    -----
    http://www.dotnetcurry.com
    -----

  • Re: The namespace 'Resources' already contains a definition for

    01-18-2008, 12:34 AM
    • Member
      48 point Member
    • satishambition
    • Member since 09-03-2007, 10:40 AM
    • Pune
    • Posts 18

    Hi,

    First only One Resource file is present in the App_GlobalResources  Folder. eg: CommonMessages.resx

    then we Programitically create the another file for different culture eg:  CommonMessages.sv-SE.resx  and copies the file to the App_GlobalResources folder

    Now there are two files  CommonMessages.resx  and  CommonMessages.sv-SE.resx  with diferent  names.

    When compliling the Application
       we get the error Given above.

    so what's the reason  for occuring this error.

    Thanks for your help
  • Re: The namespace 'Resources' already contains a definition for

    01-18-2008, 12:33 PM
    • Star
      14,584 point Star
    • david wendelken
    • Member since 07-27-2005, 11:47 PM
    • Fayetteville, NC, USA
    • Posts 2,076
    • Moderator

    I work with a 3rd party framework that uses resource files to handle multi-lingual issues.

    They arrange things a different way.

    All the resource files have the exact same name.  The "default" resource file is in the regular resources directory, and each language is in a language sub-directory below it.  The sub-directory name is the language/culture code, i.e., ca-ES, da, de, es, es-ES, fr, hr, it, and so forth.

    Hope that helps!

    If this answered your question, be sure to mark it as the answer. That way, everybody after you will know it's the answer also!
  • Re: The namespace 'Resources' already contains a definition for

    08-07-2008, 11:42 AM
    • Member
      342 point Member
    • learnerplates
    • Member since 04-14-2006, 2:37 PM
    • Ireland
    • Posts 127

     I have the same issue even thought the procedure is described here http://msdn.microsoft.com/en-us/library/fw69ke6f(VS.80).aspx

     

    http://learnerps-dotnet.blogspot.com
  • Re: The namespace 'Resources' already contains a definition for

    08-29-2008, 3:09 AM
    • Member
      6 point Member
    • jack360
    • Member since 11-07-2006, 3:56 AM
    • Posts 7
    I also have the same problem anyone run into a solution?
  • Re: The namespace 'Resources' already contains a definition for

    08-29-2008, 8:34 AM
    Answer
    • Member
      48 point Member
    • satishambition
    • Member since 09-03-2007, 10:40 AM
    • Pune
    • Posts 18

    Hi, I got the reason of this error mesage. I am using the wrong culture name for file.

    Just check the culture name you are using is present or not.
    eg. CommonMessages.fe-ex.

    the Fr-ex is not valid culture so the above given errors occured while building the application.

    you can check the supported Culture s from IE-Browser. Tools-Internate Options- Languages-Add languages

     

  • Re: The namespace 'Resources' already contains a definition for

    09-02-2008, 5:35 AM
    • Member
      342 point Member
    • learnerplates
    • Member since 04-14-2006, 2:37 PM
    • Ireland
    • Posts 127

    I found some caveats with this localization stuff, mostly with regard to the naming of the files, I've documented it here http://learnerps-dotnet.blogspot.com/2008/08/localization-and-globalization.html#links

     

    http://learnerps-dotnet.blogspot.com
  • Re: The namespace 'Resources' already contains a definition for

    05-26-2009, 7:35 AM

    You just check that you make a duplicate or renamed .aspx file that have refrance to same class,if this is ok then check your global app folder for duplicate resource file.

    Abhishek
    Linteractive,
    Div. Of Lowe Lintas India.
  • Re: The namespace 'Resources' already contains a definition for

    06-08-2009, 9:05 AM
    • Member
      5 point Member
    • tarim
    • Member since 03-01-2009, 7:20 PM
    • PA
    • Posts 17

     Hi,

     

    I have a same problem. could you help me fix it please? I don't know what should I do. need help please?

    Tarim
    www.localpcdoctor.com
  • Re: The namespace 'Resources' already contains a definition for

    06-19-2009, 1:37 PM
    • Member
      4 point Member
    • TheDonSansone
    • Member since 01-15-2009, 10:57 PM
    • Posts 3

    tarim:

     Hi,

     

    I have a same problem. could you help me fix it please? I don't know what should I do. need help please?




    I came across a novel realisation of why this error showed up in my project !!!   I'd saved my *.cs file into a different folder - deleted the original because it showed some strange link icon and thought I'd recreate it in my target folder seeing as my solution had no listing of my *.cs file now.

    Sure enough the above definition got me thinking and I did a full search for the name of my .cs file which seemed to have a duplicate somewhere.....   I didn't know Windows XP could have two of the exact same named file in the same folder tree of a project - but it did... so I deleted the older one !

    Talk about learning something new !  :-D
Page 1 of 1 (12 items)