locked
NeutralResourcesLanguage Attribute question RRS feed

  • Question

  • User1838126768 posted

    I have a GlobalResources file (.resx) for my site - - - when I run Code Analysis in VS.Net 2008 Team System, I get the following error:

    Warning 1 CA1824 : Microsoft.Performance : Because assembly 'App_GlobalResources.dll' contains a ResX-based resource file, mark it with the NeutralResourcesLanguage attribute, specifying the language of the resources within the assembly. This could improve lookup performance the first time a resource is retrieved.

    This has me totally baffled - - since I didn't create the dll, I have no idea where to set this or what it's talking about.....

    Any ideas?

    (and yes, I've searched Google and haven't found any answers)

    Friday, December 5, 2008 4:47 PM

All replies

  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    When your ASP.net web application which without precompile process is requested for the first time, it will produce the DLL file. And that is the dll which mentioned in the error message.

    <o:p> </o:p>

    The NeutralResourcesLanguage attribute informs the ResourceManager of the language that was used to display the neutral culture's resources for an assembly. When it looks up resources in the same culture as the neutral resources language, the ResourceManager automatically uses the resources that are located in the main assembly. It does this instead of searching for a satellite assembly with the current user interface culture for the current thread. This improves lookup performance for the first resource you load and can reduce your working set.

    <o:p> </o:p>

    In your scenario, you need to fix a violation of this rule, add the attribute to the assembly, specifying the language of the neutral culture's resources.

    <o:p> </o:p>

    You may follow the steps below:

    <o:p> </o:p>

    To specify the language of the neutral culture’s resource

    <o:p> </o:p>

    1,In Solution Explorer, right-click your project, and then Click Properties.

    2,From the left navigation bar select Application, and then click Assembly Information.

    3,In the Assembly Information dialog box, select the language from the Neutral Language drop-down list.

    4,Click OK.

    <o:p> </o:p>

    Thanks.

     

    Thursday, December 11, 2008 1:01 AM
  • User1838126768 posted

     What you described as a set of steps to fix my problem appears only in a Winforms application.
    It's not applicable in an ASP.Net application.

    1,In Solution Explorer, right-click your project, and then Click Properties.

    I have Property Pages

    2,From the left navigation bar select Application, and then click Assembly Information.

    I do NOT have this item  - only References/Build/Accessibility/Start Options and MSBUild Options - none of them have 'Assembly Information' in them

    3,In the Assembly Information dialog box, select the language from the Neutral Language drop-down list.

    Thursday, December 11, 2008 9:13 AM
  • User-319574463 posted

     <style></style><link href="/WebResource.axd?d=WOIf1lCHSipHaXqwFXPi6nPo5YwmKvtTlCl0NOpaby3aBlsgkutK_EHDxHKjla5rX_rXjEeUMT7PNB5CDZ9q_PlXKF2lkCbqLMxnjRWWAtk1&t=633779086660943515" id="RADEDITORSTYLESHEET0" type="text/css" rel="stylesheet"><link href="http://i3.msdn.microsoft.com/Global/EditorStyles-bn20090514.css" id="RADEDITORSTYLESHEET1" type="text/css" rel="stylesheet">A Web.Application can be fixed using the example given and the following gets added to the assembly declarations:

    <Assembly: NeutralResourcesLanguageAttribute("en-GB")>

    In C#
    [Assembly: NeutralResourcesLanguageAttribute("en-GB")]
     

    Wednesday, June 3, 2009 4:30 AM
  • User576342287 posted

    Perfect. Thank you Nai-Dong Jin.

    .

    Saturday, May 3, 2014 3:51 PM