Problems compiling resources in .Net 2.0 apps after updates.

[10 July 2007] The security patch of 10 July 2007 https://www.microsoft.com/technet/security/Bulletin/ms07-040.mspx changes culture names to use the new names on Windows XP/2003/2000 as well as Vista. 

In order to conform to RFC 4646 (replaces RFC 3066), we updated the names of some locales, which can cause applications using resources with the old names to fail to compile, usually with invalid culture or duplicate names.  The duplicates are caused because when the name isn't recognized it is ignored.  Then the default resources end up conflicting.  There are two workarounds:

a) (preferred) rename the resource files to the correct RFC 4646 names:

Old Microsoft Name

RFC 4646 Name
en-CB -> en-029
az-AZ-Latn -> az-Latn-AZ
uz-UZ-Latn -> uz-Latn-UZ
sr-SP-Latn -> sr-Latn-CS
az-AZ-Cyrl -> az-Cyrl-AZ
uz-UZ-Cyrl -> uz-Cyrl-UZ
sr-SP-Cyrl -> sr-Cyrl-CS
bs-BA-Cyrl -> bs-Cyrl-BA
sr-BA-Latn -> sr-Latn-BA
sr-BA-Cyrl -> sr-Cyrl-BA
bs-BA-Latn -> bs-Latn-BA
iu-CA-Latn -> iu-Latn-CA
div-MV -> dv-MV
zh-CHT -> zh-Hant (Aliased, may not be necessary)
zh-CHS -> zh-Hans (Aliased, may not be necessary)

b) If you cannot rename the resources or still rely on the old names, then you can create custom cultures with the old names.  See Vista changes .Net 2.0 Locale Names, sample work around custom cultures/locales

Hope this helps,

Shawn

Comments

  • Anonymous
    November 14, 2006
    Thanks for the information... one missing bit, after which updates?  I assume this is mostly Vista's .Net version, but what about service packs, .Net 3.0, etc? That said, since those old names were unique, why can't they simply be aliased forward?

  • Anonymous
    November 20, 2006
    Is the name change just for Vista or does it apply to .NET 2.0 apps on XP? For applications that are expected to run on both Vista and XP, does that mean that they'll need to have resources with both names on it?  How should it be handled?

  • Anonymous
    November 27, 2006
    The comment has been removed

  • Anonymous
    March 21, 2007
    The comment has been removed

  • Anonymous
    March 21, 2007
    The comment has been removed

  • Anonymous
    April 25, 2007
    pls provide the solution for the same..urgent

  • Anonymous
    April 26, 2007
    http://support.microsoft.com/kb/926776 should also include this change, however I didn't see a download link.  The KB asks you to contact PSS, which might be able to assist you.

  • Anonymous
    September 18, 2007
    when I am creating more than two resx files ,on compilation it gives above error.I have tried it by storing resx files in bin directory but it istnt work Pls give me solution for this I hvae tried it Error:Error 1 The namespace 'Resources' already contains a definition for 'local' c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filessatelite69b687dd6f0b631dApp_GlobalResources.i2akytfe.3.cs 12

  • Anonymous
    September 21, 2007
    If .Net doesn't recognize one of the locales (because for example its custom and customs aren't installed), then it ends up using the default locale (Invariant).  Since apps typically already have default resources you get an error. I'm not sure if this is what is happening to you, but try a short program that tries to create a new CultureInfo("en-US") for each locale you're trying to use.  If it doesn't work try creating a custom locale for that missing locale (use the CultureAndRegionInfoBuilder like in the workaround link above).

  • Anonymous
    December 03, 2008
    The comment has been removed

  • Anonymous
    January 28, 2009
    We didn't change the names for zh-CN or zh-TW (or zh-HK, etc.).  I believe that our forms are a legal variant of the zh-Latn-CN/zh-Latn-TW form, although RFC 4646 would prefer the longer form (including a script).

  • Anonymous
    February 13, 2009
    But the things I want to do is to have a CultureInfo that either says Traditional Chinese or Simplified Chinese and at the same time  specify that this culture belongs to for example China. I find no way to do this in .NET 2.0. The most logical way to do it, I think would be to use the codes zh-Hant-CN and zh-Hans-CN, but .NET would not accept those even if the RFC:s seems to say that those are the correct ones.

  • Anonymous
    March 16, 2009
    The comment has been removed

  • Anonymous
    October 28, 2010
    Has it occurred to anyone at Microsoft that it'd be nice to have a method in the System.Globalization namespace that returns an ordered list of cultures to search for? You can walk the CultureInfo.Parent chain to get from zh-CN to zh-Hans to the default, but obsolete siblings (such as zh-CHS) should appear in this list as well. Things like this are important for backward compatibility, and would let apps continue to run unbroken in the face of updates.

  • Anonymous
    October 28, 2010
    Sort of the opposite happens if I remember, zh-CHS has zh-Hans as it's parent.  This was a 1-time change some years ago, and a new API wouldn't help back-compat (because it's new :)).  Using the existing parent chain we had to make a trade-off of whether zh-Hans (the standard name) should be the parent, or if zh-CHS should be the parent.  Can't have both or you'd get stuck in a loop.  This helps some scenarios, but makes others harder.