Are vs.net embedded resources same as manually built/embedded

Are vs.net embedded resources same as manually built/embedded

Post by Jeroen N. Witmo » Tue, 01 Apr 2003 21:25:33



Perhaps you also can solve my problem ...

Our application contains error messages that have to be translated
into several human languages. To support the retrieval of the error
messages in the correct human language we want to use resources and
satellite assemblies.

So, in our batch build environment (using Nant) all is well. The
programmers write the error messages in a *.txt file, containing lines
looking like
    token = message
Then resgen.exe is invoked to transform this *.txt file into the
corresponding *.resources file, which is included into the final
result by the compile step.

My problem is to get this to work in VS.Net, which actually seems to
be two problems:
1. How do I get VS.Net to transform the *.txt file into a *.resources
file?
2. How do I get VS.Net to include this *.resources file into the
assembly?

Note that I want the contents the *.txt file to end up as Embedded
Resources; I DO NOT want to have it as 'manual' resources for which
GetManifestResourceStream() has to be used, because then in my
application I also would have to parse the stream representing the
*.txt file, instead of simply using
ResourceManager.GetString("token").

Also, if you can, please indicate if the answers are different for the
2002 version and the 2003 version of the DotNet world ...

Regards,

Jeroen.

 
 
 

Are vs.net embedded resources same as manually built/embedded

Post by MVP » Tue, 01 Apr 2003 23:32:18




Quote:> Perhaps you also can solve my problem ...

> Our application contains error messages that have to be translated
> into several human languages. To support the retrieval of the error
> messages in the correct human language we want to use resources and
> satellite assemblies.

> So, in our batch build environment (using Nant) all is well. The
> programmers write the error messages in a *.txt file, containing lines
> looking like
>     token = message
> Then resgen.exe is invoked to transform this *.txt file into the
> corresponding *.resources file, which is included into the final
> result by the compile step.

> My problem is to get this to work in VS.Net, which actually seems to
> be two problems:
> 1. How do I get VS.Net to transform the *.txt file into a *.resources
> file?

You probably have to use resgen manually for that.

Quote:> 2. How do I get VS.Net to include this *.resources file into the
> assembly?

Include it like any other item:
 "Add Existing ..." and select the converted .resources file.
Then make sure it has Build Action set as "Embedded Resource" for
that .resources file.

 - Mitch

 
 
 

Are vs.net embedded resources same as manually built/embedded

Post by MVP » Wed, 02 Apr 2003 04:40:29


VS.net supports embedding resources as raw "Manifest" resources,
or "typed" resource files (.resources) which are more properly
resource *container* files.
In VS.net you typically work with the XML-formatted .resx files
(which can be generated via  Add New Item   and  Assembly Resource File.
You can add string resources in the .resx designer.
When you compile your project, that .resx file will be compiled automatically
to a .resources file (binary version of typed resource container file) and will
be automatically built as an "embedded".
So, in VS.net, you don't need to actually build your own .resources file ... the
IDE does that work for you (although you COULD build your .resources file
manually with various tools, and manually choose to embed it via VS.net).

The following recent article is probably the clearest description of .net
resources I have seen to date:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfo...

 - Mitch
    MVP Security





> > Perhaps you also can solve my problem ...

> > Our application contains error messages that have to be translated
> > into several human languages. To support the retrieval of the error
> > messages in the correct human language we want to use resources and
> > satellite assemblies.

> > So, in our batch build environment (using Nant) all is well. The
> > programmers write the error messages in a *.txt file, containing lines
> > looking like
> >     token = message
> > Then resgen.exe is invoked to transform this *.txt file into the
> > corresponding *.resources file, which is included into the final
> > result by the compile step.

> > My problem is to get this to work in VS.Net, which actually seems to
> > be two problems:
> > 1. How do I get VS.Net to transform the *.txt file into a *.resources
> > file?
> You probably have to use resgen manually for that.

> > 2. How do I get VS.Net to include this *.resources file into the
> > assembly?
> Include it like any other item:
>  "Add Existing ..." and select the converted .resources file.
> Then make sure it has Build Action set as "Embedded Resource" for
> that .resources file.

>  - Mitch

 
 
 

Are vs.net embedded resources same as manually built/embedded

Post by Jeroen N. Witmo » Wed, 02 Apr 2003 19:28:07





> > Perhaps you also can solve my problem ...

> > Our application contains error messages that have to be translated
> > into several human languages. To support the retrieval of the error
> > messages in the correct human language we want to use resources and
> > satellite assemblies.

> > So, in our batch build environment (using Nant) all is well. The
> > programmers write the error messages in a *.txt file, containing lines
> > looking like
> >     token = message
> > Then resgen.exe is invoked to transform this *.txt file into the
> > corresponding *.resources file, which is included into the final
> > result by the compile step.

> > My problem is to get this to work in VS.Net, which actually seems to
> > be two problems:
> > 1. How do I get VS.Net to transform the *.txt file into a *.resources
> > file?

> You probably have to use resgen manually for that.

Is our situation so totally weird that it cannot be automated? Please
say it ain't so!

Jeroen.

 
 
 

Are vs.net embedded resources same as manually built/embedded

Post by Jeroen N. Witmo » Wed, 02 Apr 2003 19:37:36


Michel,

Everything you say below is true, and I thank you for your effort, but
unfortunately it is not what I need. Our management has decided that
we do not wish to expose our translators to *.resx files, nor to
winres.exe. Hence my need to include *.txt files as resource
*container* files in the VS.Net build. Note that the resources in the
*.txt files have noting to do with System.Windows.Forms.Form
resources.

Regards,

Jeroen.


> VS.net supports embedding resources as raw "Manifest" resources,
> or "typed" resource files (.resources) which are more properly
> resource *container* files.
> In VS.net you typically work with the XML-formatted .resx files
> (which can be generated via  Add New Item   and  Assembly Resource File.
> You can add string resources in the .resx designer.
> When you compile your project, that .resx file will be compiled automatically
> to a .resources file (binary version of typed resource container file) and will
> be automatically built as an "embedded".
> So, in VS.net, you don't need to actually build your own .resources file ... the
> IDE does that work for you (although you COULD build your .resources file
> manually with various tools, and manually choose to embed it via VS.net).

> The following recent article is probably the clearest description of .net
> resources I have seen to date:

> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfo...

>  - Mitch
>     MVP Security





> > > Perhaps you also can solve my problem ...

> > > Our application contains error messages that have to be translated
> > > into several human languages. To support the retrieval of the error
> > > messages in the correct human language we want to use resources and
> > > satellite assemblies.

> > > So, in our batch build environment (using Nant) all is well. The
> > > programmers write the error messages in a *.txt file, containing lines
> > > looking like
> > >     token = message
> > > Then resgen.exe is invoked to transform this *.txt file into the
> > > corresponding *.resources file, which is included into the final
> > > result by the compile step.

> > > My problem is to get this to work in VS.Net, which actually seems to
> > > be two problems:
> > > 1. How do I get VS.Net to transform the *.txt file into a *.resources
> > > file?
> > You probably have to use resgen manually for that.

> > > 2. How do I get VS.Net to include this *.resources file into the
> > > assembly?
> > Include it like any other item:
> >  "Add Existing ..." and select the converted .resources file.
> > Then make sure it has Build Action set as "Embedded Resource" for
> > that .resources file.

> >  - Mitch

 
 
 

Are vs.net embedded resources same as manually built/embedded

Post by MVP » Thu, 03 Apr 2003 00:19:09


I think the only current solution is to use:
  Resgen  your.txt
and then use VS.net to embed the resultant container resources in your.resources
into your project. Thus, some manual intervention is required.

 - Mitch



Quote:> Michel,

> Everything you say below is true, and I thank you for your effort, but
> unfortunately it is not what I need. Our management has decided that
> we do not wish to expose our translators to *.resx files, nor to
> winres.exe. Hence my need to include *.txt files as resource
> *container* files in the VS.Net build. Note that the resources in the
> *.txt files have noting to do with System.Windows.Forms.Form
> resources.

> Regards,

> Jeroen.

 
 
 

1. Build issue with VS.NET and embedded resource

Hi,

(I hope this hasn't been debated yet.)

In a C# project, it is easy to add an XML file as an resource (i.e.
Build action = Embedded resource).

If the XML file is changed, I would expect VS.NET to update the
resource during the next build. Unfortunately, this does not happen.
One must 'Rebuild' the project for the file to be newly embedded in
the assembly. A simple 'Build' has no effect.

Anyone has experienced this ?

TIA,

---
Jean-Marie Pirelli
ELCA Informatique SA
Switzerland

2. Free ATR 8500 (almost) to good home

3. Why are embedded resources so hard to use within the vs.net wysiwyg environment?

4. Parallel Debugger

5. How to load a VS.NET embedded bitmap resource

6. Dashboard Themes

7. Why setting "Build Action" to "Embedded Resource" wont work???

8. starting up a process using interrupt

9. Embedding resources in VS IDE

10. Playing an embedded resource wav in VB.NET ?

11. Has anyone successfully embedded a default resource file in ASP.NET app?

12. how to manually build a VS.NET project