Resource DLL generation at compilation stage

A

Alain Dekker

I've inherited a C# project written in VS 2005 from a colleague who has
left. There was very little hand-over time. Most things work fine, but one
thing that I'm totally in the dark about is how the Internationalization
DLLs were produced.

On compile, I get an EXE, a few other DLLs and then a bunch of folders get
created with two letters like "de" (German) and "nl" (Dutch) and so on.
Currently 13 folders get created. In each folder, a DLL sits with the name
"APPNAME.resources.dll". At runtime, the user-selected language points the
application to the correct resource DLL and loads the appropriate string
resource. This all works great. Quite impressive.

During compilation, the Output of IDE shows this:

// All the normal compilation messages
Compile complete -- 0 errors, 0 warnings
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AL.exe /culture:af
/out:blush:bj\Release\de\Exporter.resources.dll
/template:blush:bj\Release\Exporter.exe
/embed:blush:bj\Release\Exporter.uif_strings.de.resources
// ...and all the other languages as well

The problem is...I don't know how these folders or DLLs get generated! There
are a bunch of RESX files in the project (eg. uif_strings.de.resx for
German) with the localised strings in them. Somehow these are compiled into
DLLs and put into these two-letter folders. My task now is to add Japanese.
I've got all the Japanese strings together, and created a
uif_strings.jp.resx file which has been added to the project. But the
resource DLL and folder (jp) are not being created.

I've searched everywhere I can think of in the project (csproj) file, the
properties of the various resx files, etc but cannot see how these resource
DLLs are being instructed to be produced.

Any pointers on where I should be looking?

Thanks,
Alain
 
A

Alain Dekker

Thanks. I've delved deeper and I really like the way .NET is handling string
allocation with the satellite assemblies, etc.

Only problem is, there's tonnes of information about what to generate, not
how to generate. For example, on this MSDN page
(http://msdn.microsoft.com/en-us/library/c405shex(v=VS.80).aspx) about
the Assembly Linker, it gives me the commands that are doing the actual jon
of generating the satellite assembly.

Great. But where, of where, is that example they give "al t2.netmodule
/target:exe /out:t2a.exe /main:MyClass.Main" written in my project?

The csproj contains no reference whatsoever to al or AL.EXE or anything I
can recognise. I just cannot find where the IDE is being told "Generate the
satellite assemblies". None of the RESX files that are working appear any
different to my Japanese (jp) RESX file, so I don't think its anything
automatic, there must be somewhere written "Use the AL tool to create the
satelleite DLL for DE, German"...but where???

Getting frustrated...
Alain

Peter Duniho said:
[...]
The problem is...I don't know how these folders or DLLs get generated!
There
are a bunch of RESX files in the project (eg. uif_strings.de.resx for
German) with the localised strings in them. Somehow these are compiled
into
DLLs and put into these two-letter folders. [...]

I've searched everywhere I can think of in the project (csproj) file, the
properties of the various resx files, etc but cannot see how these
resource
DLLs are being instructed to be produced.

Any pointers on where I should be looking?

Typically, each language would be found in its own folder under the
"Resources" folder of the project.

For best results, you should try to understand as much of the process as
is feasible. You can find lots of relevant documentation here:
http://msdn.microsoft.com/en-us/library/1021kkz0.aspx

For your particular issue at the moment, this would be a good place to
start:
http://msdn.microsoft.com/en-us/library/756hydy4.aspx

Hopefully, the project was organized per the usual VS conventions, so that
the documentation and any advice you might get here apply. If not, you'll
just have to figure it out yourself or ask the person who did it.

Pete
 
J

James A. Fortune

I've inherited a C# project written in VS 2005 from a colleague who has
left. There was very little hand-over time. Most things work fine, but one
thing that I'm totally in the dark about is how the Internationalization
DLLs were produced.

On compile, I get an EXE, a few other DLLs and then a bunch of folders get
created with two letters like "de" (German) and "nl" (Dutch) and so on.
Currently 13 folders get created. In each folder, a DLL sits with the name
"APPNAME.resources.dll". At runtime, the user-selected language points the
application to the correct resource DLL and loads the appropriate string
resource. This all works great. Quite impressive.

During compilation, the Output of IDE shows this:

// All the normal compilation messages
Compile complete -- 0 errors, 0 warnings
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AL.exe /culture:af
/out:blush:bj\Release\de\Exporter.resources.dll
/template:blush:bj\Release\Exporter.exe
/embed:blush:bj\Release\Exporter.uif_strings.de.resources
// ...and all the other languages as well

The problem is...I don't know how these folders or DLLs get generated! There
are a bunch of RESX files in the project (eg. uif_strings.de.resx for
German) with the localised strings in them. Somehow these are compiled into
DLLs and put into these two-letter folders. My task now is to add Japanese.
I've got all the Japanese strings together, and created a
uif_strings.jp.resx file which has been added to the project. But the
resource DLL and folder (jp) are not being created.

I've searched everywhere I can think of in the project (csproj) file, the
properties of the various resx files, etc but cannot see how these resource
DLLs are being instructed to be produced.

Any pointers on where I should be looking?

Thanks,
Alain

Here is some auxiliary information:

The PDC08 presentation:

PC52 - Windows 7: Writing World-Ready Applications

goes into detail about how Microsoft packages their software resources
for internationalization.

James A. Fortune
(e-mail address removed)
 
A

Alain Dekker

Thanks, I am busy downloading the video and will watch this shortly.

Alain

I've inherited a C# project written in VS 2005 from a colleague who has
left. There was very little hand-over time. Most things work fine, but one
thing that I'm totally in the dark about is how the Internationalization
DLLs were produced.

On compile, I get an EXE, a few other DLLs and then a bunch of folders get
created with two letters like "de" (German) and "nl" (Dutch) and so on.
Currently 13 folders get created. In each folder, a DLL sits with the name
"APPNAME.resources.dll". At runtime, the user-selected language points the
application to the correct resource DLL and loads the appropriate string
resource. This all works great. Quite impressive.

During compilation, the Output of IDE shows this:

// All the normal compilation messages
Compile complete -- 0 errors, 0 warnings
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AL.exe /culture:af
/out:blush:bj\Release\de\Exporter.resources.dll
/template:blush:bj\Release\Exporter.exe
/embed:blush:bj\Release\Exporter.uif_strings.de.resources
// ...and all the other languages as well

The problem is...I don't know how these folders or DLLs get generated!
There
are a bunch of RESX files in the project (eg. uif_strings.de.resx for
German) with the localised strings in them. Somehow these are compiled
into
DLLs and put into these two-letter folders. My task now is to add
Japanese.
I've got all the Japanese strings together, and created a
uif_strings.jp.resx file which has been added to the project. But the
resource DLL and folder (jp) are not being created.

I've searched everywhere I can think of in the project (csproj) file, the
properties of the various resx files, etc but cannot see how these
resource
DLLs are being instructed to be produced.

Any pointers on where I should be looking?

Thanks,
Alain

Here is some auxiliary information:

The PDC08 presentation:

PC52 - Windows 7: Writing World-Ready Applications

goes into detail about how Microsoft packages their software resources
for internationalization.

James A. Fortune
(e-mail address removed)
 
A

Alain Dekker

Hi Pete,

Thanks. You are right that I need to take a step back. I'm trying to
shortcut some of the steps needed to gain a full understanding of how to
generate these satellite assemblies because I am "simply" trying to add
Japanese to an application that already supports German, Polish, Mandarin
and several other languages.

This is understandable, though, because I do not find myself with a lot of
time to get the Japanese integrated. Nevertheless, I will now take the time
to more fully understand what is required.

I was directed to the link to the Assembly Linker (AL) by yourself, either
directly or through the onward links on the MSDN documentation. This does
not appear to be "code" problem (hence I am not able to give code samples).
This seems to me to be a compiler options problem.

My uif_strings.jp.resx (Japanese resource file) is compiled into a
APPNAME.uif_strings.jp.resources file, in exactly the same way as the
German, Mandarin and other resource files are generated. These files are
generated during compilation in the APPNAME\obj\Debug directory. But the
step thereafter to generate the two letter folder (jp in this case) is not
working. The IDE continues its compilation, generates the German, Mandarin
and other satellite assemblies (skipping the new Japanese one) and then
reports "Rebuild All succeeded" in the bottom left corner. The application
runs perfectly (except of course I see English when I choose Japanese).

I've opened up all (what I consider) relevant files, such as the CSPROJ
file, in Notepad and just cannot see how the German and Mandarin and other
satellite assemblies are instructed to be generated.

I will now take the time to follow your suggestion and go a bit more slowly
through the MSDN documentation and examples. Thanks for your time (given
freely and this is much appreciated). If you have anything else to add to
help shortcut the (elusive?) search, that would be very much appreciated.

Regards,
Alain


Peter Duniho said:
Thanks. I've delved deeper and I really like the way .NET is handling
string
allocation with the satellite assemblies, etc.

Only problem is, there's tonnes of information about what to generate,
not
how to generate. For example, on this MSDN page
(http://msdn.microsoft.com/en-us/library/c405shex(v=VS.80).aspx)
about
the Assembly Linker, it gives me the commands that are doing the actual
jon
of generating the satellite assembly.

Great. But where, of where, is that example they give "al t2.netmodule
/target:exe /out:t2a.exe /main:MyClass.Main" written in my project? [...]

Maybe you could explain what it is that led you to the documentation for
the Assembly Linker. There's no reason you should need to concern
yourself with its use, no more than you need to concern yourself with the
specific command link options needed for the C# compiler.

This page, http://msdn.microsoft.com/en-us/library/21a15yht.aspx, explains
how the Assembly Linker is used to build satellite assemblies from your
.resources files, but Visual Studio should be taking care of all that for
you. I have never needed to know anything about the Assembly Linker per
se in order to build a localized program.
[...]
Getting frustrated...

It's been my experience that, when diving into the middle leaves me
feeling lost and frustrated, it is helpful to take a step back, ignore the
specific business project at hand, and start from scratch with the
tutorials and examples provided in the documentation. Those are much
simpler, and guaranteed to fit what the documentation says.

Once you know how things normally work in .NET, then you can look more
closely at your own business project. Either it will be as you expect it
to be, in which case your experience with the documentation's examples
will have educated you sufficiently for you to understand how the project
works, or it will not be as you expect it to be, in which case you will
have a good enough understanding of how it's normally supposed to work to
be able to identify how and why your own business project is different and
how to deal with that.

You haven't provided any sort of concise-but-complete code example showing
exactly what the code you're trying to maintain looks like. While it would
be ideal if that code follows the conventions used in .NET, there's not
actually any guarantee that it does so. All that I or anyone else can
comment on is how things normally work in .NET. Until you have confirmed
both that a) you understand how things normally work in .NET, and b) that
the project you're trying to maintain follows the normal .NET convention,
there's no way to guarantee that advice that follows the .NET convention
will be in any way applicable to your specific question.

Pete
 
A

Alain Dekker

Renaming my resource RESX file from

uif_strings.jp.resx

to

uif_strings.ja.resx

makes it work.
Alain


Peter Duniho said:
Thanks. I've delved deeper and I really like the way .NET is handling
string
allocation with the satellite assemblies, etc.

Only problem is, there's tonnes of information about what to generate,
not
how to generate. For example, on this MSDN page
(http://msdn.microsoft.com/en-us/library/c405shex(v=VS.80).aspx)
about
the Assembly Linker, it gives me the commands that are doing the actual
jon
of generating the satellite assembly.

Great. But where, of where, is that example they give "al t2.netmodule
/target:exe /out:t2a.exe /main:MyClass.Main" written in my project? [...]

Maybe you could explain what it is that led you to the documentation for
the Assembly Linker. There's no reason you should need to concern
yourself with its use, no more than you need to concern yourself with the
specific command link options needed for the C# compiler.

This page, http://msdn.microsoft.com/en-us/library/21a15yht.aspx, explains
how the Assembly Linker is used to build satellite assemblies from your
.resources files, but Visual Studio should be taking care of all that for
you. I have never needed to know anything about the Assembly Linker per
se in order to build a localized program.
[...]
Getting frustrated...

It's been my experience that, when diving into the middle leaves me
feeling lost and frustrated, it is helpful to take a step back, ignore the
specific business project at hand, and start from scratch with the
tutorials and examples provided in the documentation. Those are much
simpler, and guaranteed to fit what the documentation says.

Once you know how things normally work in .NET, then you can look more
closely at your own business project. Either it will be as you expect it
to be, in which case your experience with the documentation's examples
will have educated you sufficiently for you to understand how the project
works, or it will not be as you expect it to be, in which case you will
have a good enough understanding of how it's normally supposed to work to
be able to identify how and why your own business project is different and
how to deal with that.

You haven't provided any sort of concise-but-complete code example showing
exactly what the code you're trying to maintain looks like. While it would
be ideal if that code follows the conventions used in .NET, there's not
actually any guarantee that it does so. All that I or anyone else can
comment on is how things normally work in .NET. Until you have confirmed
both that a) you understand how things normally work in .NET, and b) that
the project you're trying to maintain follows the normal .NET convention,
there's no way to guarantee that advice that follows the .NET convention
will be in any way applicable to your specific question.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top