0
Reply

VB.NET 2008 Get resource file as IO.Stream

dxmedia

dxmedia

Jul 5 2010 7:26 PM
4.6k
I am developing a VB.NET 2008 application, consisting of a main EXE application and

several resource DLLs.

I am trouble with two functions for the DLL:

1) one function to get a list of all files in the resources of the DLL.
2) one function to return 'by name' a resource file as a System.IO.Stream type.

NOTE: The files will not be "Embedded Resource" (this doubles the size of the DLL), so I

think cannot use 'GetManifestResourceStream'.

I currently use:

Return New System.IO.MemoryStream(My.Resources.MyFileName)

but I want it to be called by name.



I am adding the resources using the VS 2008 "Resources" tab, from the My Project screen,

I'm not manually editing Resources.resx

As I said before, it works with:

Return New System.IO.MemoryStream(My.Resources.MyFileName)

but I need to get the resources by name, which also works by using

GetMAnifestResourceStream

but this requires to set the resources Build Action to "Embedded Resource", which doubles

the size of my DLL file.

I currently use "None" as Build Action, but I can use any Build Action that does not

increase the file size more than the actual resources size.


Need help.