Welcome to MSDN Blogs Sign in | Join | Help

Problems compiling resources in .Net 2.0 apps after updates.

[10 July 2007] The security patch of 10 July 2007 http://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

Published Tuesday, November 14, 2006 11:59 AM by shawnste

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Problems compiling resources in .Net 2.0 apps after updates.

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?

Tuesday, November 14, 2006 11:43 PM by Marc Brooks

# re: Problems compiling resources in .Net 2.0 apps after updates.

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?

Monday, November 20, 2006 1:05 PM by onovotny

# re: Problems compiling resources in .Net 2.0 apps after updates.

This applies mostly to the version shipped with Vista, although any other .Net 2.0 apps with most any current QFE applied could also have this behavior.

There are difficulties with aliasing, for example, if you build a CultureInfo with the old non-standard name and then did a ToString would you expect the old or new name?  Our investigation showed that for the chinese neutrals aliasing was required.  For many cases aliasing could be just as bad or worse than not aliasing.

Long term we'd like to have a better plan in case ISO changes tags (like when a country splits or changes), but in the meantime custom cultures should solve many problems when the expected names differ.  Serbia and Montenegro have that problem and others may.

I'd also recommend that apps use names, but realize that the names might change due to ISO changes.  Hopefully the standards won't change in so severe a manner in the future, however cases like Serbia and Montenegro will causes shifts in the ISO names.  I'll blog more soon.

Monday, November 27, 2006 2:30 PM by shawnste

# re: Problems compiling resources in .Net 2.0 apps after updates.

This is currently causing us major pain!

Since our product has to localized for Serbia we have many resource files with the extension sr-SP-Latn. Now the first developer upgraded his machine to VISTA and all hell breaks loose. We had to change ALL extensions to .sr-Latn-CS (a few 100 files) only to find out, that the old version is now not compiling.

We are currently trying the workarround mentioned in this article .... and a colleague just reported: it works! Thanks Shawn, at least your blog entry helped.

BUT: Does Microsoft honestly not provide a solution to develop an application in a team consisting of 10+ developers in a mixed environment (XP + Vista).

The solution would obviously be to provide a patch to add the new rfc names to an xp environment?

Wednesday, March 21, 2007 9:04 AM by hannes

# re: Problems compiling resources in .Net 2.0 apps after updates.

I'm sorry that you're experiencing pain.  We have a QFEs that fix this in .Net 2.0, and it will be fixed in the next version.  Note that these fixes change to the corrected names, so the old names won't work unless you install a custom culture with the old names.

That, of course, leaves the question of how to get the QFE with the fix for XP, which I'm not sure about.  I'll try to figure that out and post back here.

Wednesday, March 21, 2007 3:12 PM by shawnste

# problem when i am running resource error is The resource file '/bopoweb/App_GlobalResources/resources.elertresource.resx' cannot be used, as it conflicts with another file with the same name.

pls provide the solution for the same..urgent

Thursday, April 26, 2007 3:11 AM by Pavan Naidu

# re: Problems compiling resources in .Net 2.0 apps after updates.

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.

Thursday, April 26, 2007 6:29 PM by shawnste

# re: Problems compiling resources in .Net 2.0 apps after updates.

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:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\satelite\69b687dd\6f0b631d\App_GlobalResources.i2akytfe.3.cs 12

Wednesday, September 19, 2007 1:45 AM by suryakant

# re: Problems compiling resources in .Net 2.0 apps after updates.

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).

Friday, September 21, 2007 12:45 PM by shawnste

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker