Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

.Net 2.0 App_GlobalResources within VS.NET 2008

with one comment

If you ever done globalization & localization your web application/website you must have appreciated  the way Microsoft approach the problem through App_LobalResources as well as App_GlobalResources. However since I am not a WebForm’s fan App_LocalResources is not my friend but App_GlobalResources.

Not until I recently had to Rebuild my web application within VS.NET 2008 and it complains about resources name already defined ???? What the heck !

The namespace 'Resources' already contains a definition ...

CS0101: The namespace 'Resources' already contains a definition for 'Messages'

I fired up Firefox searching the entire net and yeah I am not the only one experience the pain but none of their suggestion would work for me. Well most of them advice to remove the resources file and keep a single of them “fall back resource” but hell that will make localization suck what the point?

But I remembered, I didn’t have this kind of problem in previous version of the IDE? How about trying that one more time? ack I no longer had a copy of VS.NET 2005 installed fine call a friend get sharing his laptop view via Microsoft SharedView and mess around; finally I can confirm that it everything work perfectly so it must be the “VS.NET 2008”

The last thing I did was load my solution under vs.net 2008 and upgrade my web application runtime from 2.0 to 3.5 and recompile the app. again and guess what? IT WORKS !! YEAH and that stressed me out a bit since I did not want to upgrade .net runtime on the server just YET.

Anyway that is my story; do you know a better way to fix the problem without upgrade my web application runtime?

update: the solution above somehow wacky and I got to admit the best way to deal with this is using satellite assembly approach here are a few links:

I  had to use pre-build event to generate necessary satellite assembly like this

cd $(ProjectDir) resgen.exe MyResource.resx
al.exe /t:lib
   /embed:MyResource.resources
   /out:bin\en-GB\$(ProjectName).resources.dll /c:en-GB

resgen.exe MyResource.km-KH.resx $(ProjectName).MyResource.km-KH.resources
al.exe /t:lib
   /embed:$(ProjectName).MyResource.km-KH.resources
   /out:bin\km-KH\$(ProjectName).resources.dll /culture:km-KH

Note: make sure you created bin\en-GB and bin\km-KH before build the project.

Advertisements

Written by Chorn Sokun

September 2, 2008 at 9:13 am

One Response

Subscribe to comments with RSS.

  1. […] in MonoRail, Tips & Tricks by chornsokun on September 10th, 2008 In my previous post “.Net 2.0 App_GlobalResources within VS.NET 2008” I was successfully manipulate string stored in satellite assembly that was the isolation […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: