Click here to Skip to main content
13,193,048 members (83,023 online)
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 13 Nov 2010

Create satellite assemblies with ResX Builder

, 13 Nov 2010
Rate this:
Please Sign up or sign in to vote.
How to create satellite assemblies with ResX Builder.


Localization in Visual Studio is very good, and whilst I found it suitable for almost every situation, there is one issue that can cause a lot of grief; how does one deploy new satellite assemblies when an application has already been built? For many small projects, this is not an issue, and the developer simply deploys a new version. However, this is not always an easy choice to make. Wouldn't it be wonderful to create a satellite assembly and upload it to your application without having to rebuild? Well, you can! Let's start seeing how...

Traditional method: If you have the time and energy to work it out, you will come to use resgen.exe and al.exe, two tools included with the Visual Studio installation. Resgen.exe will take a RESX file and spit out a .resources file. Then, you take this, and with a load of different (and tricky syntax) commands, you will end up having written something like this:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\resgen.exe" 
    "HelloResX.ja-JP.resx" "ResXTest.HelloResX.ja-JP.resources"

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\al.exe" /t:lib 
   /out:"ja-JP\ResXTest.resources.dll" /culture:ja-JP 

It may look easy, but I tell you... it can cause some serious grief at times. Right, so to minimize on grief, I have written a nice GUI utility that I hope some of you will find useful. Let's get into explaining ResXBuilder then...

Simplifying the process with ResX Builder

All you need to do is fire up the tool, enter some info, and click Build, then voila; your new satellite assembly is ready to deploy.


As you can see from the screenshot above, the main area is a grid, and basically what this is for is editing the values of an existing .resx file. For example, say you have a default .resx file called HelloResX.resx; you tell the tool where to find the template file (your default .resx file) and then click Load. This will bring up all the name/value pairs in a grid that you can edit. Once you're done translating, simply select a culture and specify the resource namespace and project name, then click Build. That's it; you're ready to deploy!

A demo app

In the attached source code, you will find a demo project. In there, you will see the following simple code:

static void Main(string[] args)
   List<string> cultures = new List<string>();


private static void HiBye(string cultureCode)
   HelloResX.Culture = CultureInfo.GetCultureInfo(cultureCode);
   Console.WriteLine("Culture: {0}", cultureCode);
   Console.WriteLine("Hello: {0}", HelloResX.Hello);
   Console.WriteLine("Goodbye: {0}", HelloResX.Goodbye);

Basically, I only have one resources file: HelloResX.resx, and because it is strongly typed, we can call the properties on it directly. By default, it will use the current culture, but if you change the Culture property as in the above code, it will try to locate the required satellite assembly from the bin folder. What I am doing in the above code is setting the culture 5 times for 5 different cultures and writing the name/value pairs to the Console. Of course, in a real world app, you won't know what cultures to load, and you would get the user to select the culture they want to use from a dropdown or something, and then try load it from there. The images below show before and after I added the satellite assemblies to the bin folder.






Satellite assemblies; very useful... command line tools to generate them; nasty... GUI tools to handle the issue; makes generating satellite assemblies quick and easy. Enjoy!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Freelancer
Australia Australia
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionWhy 4 stars Pin
Stefan Vasiljevic28-Oct-14 4:00
memberStefan Vasiljevic28-Oct-14 4:00 
Bug[My vote of 1] Vote of 1 Pin
Member 467008624-Dec-13 12:08
memberMember 467008624-Dec-13 12:08 
GeneralMy vote of 5 Pin
dheerajv25-Jul-12 16:44
memberdheerajv25-Jul-12 16:44 
QuestionMBG not found--code is not working Pin
MrNilesh14-Dec-11 23:54
memberMrNilesh14-Dec-11 23:54 
AnswerRe: MBG not found--code is not working Pin
De Nardis Andrea24-Mar-12 7:34
memberDe Nardis Andrea24-Mar-12 7:34 
GeneralMy vote of 1 Pin
bcraun18-Mar-11 10:03
memberbcraun18-Mar-11 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171017.2 | Last Updated 14 Nov 2010
Article Copyright 2010 by vnmatt
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid