locked
Adding new resource file throwing error from temp directory. RRS feed

  • Question

  • User34108037 posted

    Hi,

    I am using App_GlobalResoureces directory for different languages . I have 4 languages in my resource directory. while adding one more language file in that directory and building the application am getting the error from temp directory.

    Error    22    The namespace 'Resources' already contains a definition for 'SharedResources'    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\xxxxxx\aaadd408\1d98c717\App_GlobalResources.kcelge13.1.cs    12   

    I have done the following to fix the above , but didn't get the work around.

    1.Deleted the project directory from temp (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\) directory and rebuild the application.

    2. Restarted the system.

    Can anyone have solution for this?

    Suresh.



    Wednesday, June 29, 2011 5:12 AM

Answers

All replies

  • User-269404413 posted

    Suresh,

    Dealing with Portal-Specific Resources in App_GlobalResources
    Once the .resx extension has been re-enabled, ASP.NET will begin compiling existing .resx resource files. However, this will cause a problem for those resources that have been localized for a specific portal. DotNetNuke creates these files with a [FileName].Portal-[PortalId].resx format (e.g. “SharedResources.Portal-0.resx”). When the ASP.NET resource compiler attempts to compile these files, it will generate an error. This is because ASP.NET expects the “Portal-[PortalId]” token to be a valid language (e.g. en-US). Obviously, “Portal-[PortalId]” is not a valid language, and the resource compiler chokes with: “CS0101: The namespace ‘Resources’ already contains a definition for ‘SharedResources’”

    If you never expect to localize any of your resources (never!), then you will not encounter this situation, and may skip this step.

    Otherwise, we are thus forced to prevent the ASP.NET resource compiler from compiling these files. Although I am not fully happy with this solution, to date the best method that I have found to accomplish this is to rename the App_GlobalResources directory.

    This requires two changes:

    1) Rename your App_GlobalResources directory to GlobalResources.

    2) Update the DotNetNuke core to look in the new GlobalResources directory. This value is set on or about line 73 of Library/Components/Localization/Localization.vb:

    Public Const ApplicationResourceDirectory As String = “~/App_GlobalResources”

    Changed to:

    Public Const ApplicationResourceDirectory As String = “~/GlobalResources”

    I have requested that this value be settable via external configuration so that a core compilation is not required, but this is yet unimplemented.

    read this web page

    Wednesday, June 29, 2011 8:10 AM
  • User34108037 posted

    Hi Jayaseelan,

    Thanks for your response. I didn't use the dotnetnuke. Also I found why we are getting that problem.

    Can you please check this blog ?

    http://pohsze.wordpress.com/2008/11/10/cant-create-chinese-resource-file-resourcezhresx-under-app_globalresources/

    Suresh.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 29, 2011 9:59 AM