how to create resx - Files for the CF

  • Thread starter Thread starter Carsten Marx
  • Start date Start date
C

Carsten Marx

Hello,
i have some small pictures and some xml-Files which i need in my
application.
I want to include the as embeeded resource, so that they are not visible
for the user.
How can i do this without the designer? And how can i access this resx -
resources.


thanks for any help


Carsten
 
Add the files to your project as embedded resources (look at the properties
window for each file).

From code, look up the method GetManifestResourceStream, i.e.:
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(...)

Cheers
Daniel
 
In the Solution Explorer select your xml-file and in the Properties
Window (F4) set Build Action to Embedded Resource. After that you can
retrieve this XML stream with:

System.IO.Stream s =
Assembly.GetExecutingAssembly().GetManifestResourceStream("YourApplication.YourFile.xml");



Best regards,
Sergey Bogdanov
 
Sergey said:
In the Solution Explorer select your xml-file and in the Properties
Window (F4) set Build Action to Embedded Resource. After that you can
retrieve this XML stream with:

System.IO.Stream s =
Assembly.GetExecutingAssembly().GetManifestResourceStream("YourApplication.YourFile.xml");
ok... i think my brain is sick....
my main method is in a file called Start.cs
in the constructor of this file i want access the xml-file via:
Assembly.GetExecutingAssembly().GetManifestResourceStream("MobileMedioVis.OnlinePG.xml");
my fiel OnlinePG.xml is declared a embedded resource and the
folder-structure is:
Start.cs
-DATA
-DEFAULTS
OnlinePG.xml
(DATA and DEFAULTS are folders)

my namespace is MedioVis
and my Assembly Name is [assembly: AssemblyTitle("MobileMedioVis")]

what is wrong?


regards
Carsten
 
The namespace must reflect the full path to your file:

GetManifestResourceStream("MobileMedioVis.DATA.DEFAULTS.OnlingPG.xml")

Best regards,
Sergey Bogdanov


Carsten said:
Sergey said:
In the Solution Explorer select your xml-file and in the Properties
Window (F4) set Build Action to Embedded Resource. After that you can
retrieve this XML stream with:

System.IO.Stream s =
Assembly.GetExecutingAssembly().GetManifestResourceStream("YourApplication.YourFile.xml");
ok... i think my brain is sick....
my main method is in a file called Start.cs
in the constructor of this file i want access the xml-file via:
Assembly.GetExecutingAssembly().GetManifestResourceStream("MobileMedioVis.OnlinePG.xml");

my fiel OnlinePG.xml is declared a embedded resource and the
folder-structure is:
Start.cs
-DATA
-DEFAULTS
OnlinePG.xml
(DATA and DEFAULTS are folders)

my namespace is MedioVis
and my Assembly Name is [assembly: AssemblyTitle("MobileMedioVis")]

what is wrong?


regards
Carsten
 
Sergey said:
The namespace must reflect the full path to your file:

GetManifestResourceStream("MobileMedioVis.DATA.DEFAULTS.OnlingPG.xml")


thanks a lot...


Carsten
 
Back
Top