Building sattelite assemblies in the Visual Studio IDE...

by Michael S. Kaplan, published on 2005/01/10 08:39 -08:00, original URI: http://blogs.msdn.com/michkap/archive/2005/01/10/349988.aspx


This seemed like a useful tip to share, originally posted in the newsgroup....

The question that was asked:

I've internationalized my product. From most of the reading I've done, it seems that the satellite assemblies need to be built "by hand" and so I'vedone this in the post-build step of my project although this is not very elegant.

However, I notice that when doing a build of any old c# project, the mysterious message "Building satellite assemblies..." gets spit out as partof the build. Does this mean there is some way that Visual Studoi can build the satellite assemblies for me that I am not aware of?

And the answer (given by Kai Brinkmann of Microsoft):

You do not *have* to build your satellite assemblies by hand (using resgen and al). You can, of course, which allows you to modify existing assemblies or add new languages without having to rebuild everything, but the IDE can certainly handle it for you!

All you have to do is add the .resx files for each language to your project. Make sure you follow the proper naming conventions, i.e. <Base Name>.<culture ID>.resx. The language neutral and fallback resources can also be added as <Base Name>.resx. (These resources will be embedded in the main assembly containing your code.) When you build your project, the appropriate satellite assemblies (<Base Name>.resources.dll) will automatically be created in the appropriate directories (culture ID) underneath your output directory (bin/<Configuration>). You'll notice that you won't have access to the .resources files this way (created manually using resgen). They are created at compile time, of course, and then embedded into the DLLs. However, they are not actually saved as separate files.

Now I did not know that either, but it is pretty cool either way. :-)

Andrew Eames, the guy who asked the original question, also made some observations after getting this cool advice for those who want to try this....

1) This should really be made clearer in the MSDN help - all of the localization topics in the help lead you towards using resgen and al - I didn't find any reference to the fact you could do this in VS

2) The localized .resx files for controls and forms are not visible in the Solution Explorer unless Show all Files is Checked. Thus if you add a localized .resx file for a form it doesn't look like anything has happened

3) For some odd reason, I had to add my localized files *twice* into the solution before they would appear. The first time, it seemed to go away and do something but the file wasn't added - the second time it actually got added to the solution

4) Selecting multiple .resx files to add in the Add Item dialog didn't seem to work - maybe this is related to 3)

I agree completely with #1 -- hopefully this post will do until that happens. #2 is also true (I always have that checked so I did not realize that things were being hidden that way!).

This post is brought to you by "Ç" (U+00c7, a.k.a. LATIN CAPITAL LETTER C WITH CEDILLA)


# Joe on Monday, January 10, 2005 8:57 AM:

You're right that it's not very clear in MSDN and not easy to use. Vote to improve it here:

http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=4fe229b4-276d-4721-a9d2-0489448a0eba

# Jason on Monday, December 21, 2009 3:15 AM:

Very useful.  MSDN still doesn't mention this, and it's been 5 years!


Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day