RESX Files and command line compilation

T

Todd Acheson

TOOLS: Visual Studio.NET 2003
.NET SDK

GOAL: Reproduce the DLL's that our Visual Studio.NET development boxes
create, by using the SDK command line compilers

DILLEMA: RESX Files, how to handle

How does VS.NET handle RESX files when a developer builds the solution?
Does VS.NET use the "/res:filename.resx" command line option? Does it
invoke the RESGEN and AL programs? If a RESX file appears empty, is it
ignored by the compiler? (I would guess yes) If so, how does it know the
file is empty?

My command line DLL's are about 2x the size of a VS.NET DLL when I use the
"/res:" command line option.
When I exclude the RESX files, my command line DLL's are 10-15% smaller than
the VS.NET DLL's.
Our RESX files are in the default state the VS.NET created them. We have
not added any information to them, but may have to soon.

Our build box does not have VS.NET installed on it, so it is not an option
at this time.

Any insight you can provide would be most helpful and appreciated.

-Todd
 
J

Jacob Yang [MSFT]

Hi Todd,

The VS.NET uses a hub and spoke model to package and deploy resources. The
hub is the main assembly that contains the nonlocalizable executable code
and the resources for a single culture, called the neutral or default
culture. The default culture is the fallback culture for the application.
Each spoke connects to a satellite assembly that contains the resources for
a single culture, but does not contain any code.

The hub and spoke model requires that you place resources in specific
locations, so that they can be easily located and used. If you do not
compile and name resources as expected, or if you do not place them in the
correct locations, the common language runtime will not be able to locate
them. As a result, the runtime uses the default resource set.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Todd Acheson

Jacob,
Thanks for the reply. I am somewhat aware of the hub and spoke model. But
I think my question still remains unanswered.
How does VS.NET handle resx files, and technically, how can I replicate this
action with the command line compilers, so that my resulting DLL's are the
same as what Visual Studio produces?

-Todd
 
J

Jacob Yang [MSFT]

Hi Todd,

Thank you for your update.

As I mentioned above, the VS.NET will compile with a default culture, which
causes the compiled assembly a little bigger than what generated with the
command line without /:resource option.

You can do the same thing with the command line by specifying a non-culture
(neutral) resource file.

Please let me know if the information above helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Todd Acheson

Jacob,
Thanks for the info. You have put me on the path I was seeking.

Looking at the Output window in VS.NET, I can see the following feedback as
the assembly is built:
Preparing resources...
Updating references...
Performing main compilation...
Building satellite assemblies...

From my limited knowledge, and the knowledge you have supplied, I think I
have been able to replicate what VS.NET is doing in all these steps.
If I build *.resource file(s) from all my RESX pages, and then include these
new *.resource with the /resource: option, my DLLs are now almost identical.
My mistake previsously was to include the RESX file by themselves, without
running resgen.exe.

Thank you!

-Todd
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top