Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / September 2004

Tip: Looking for answers? Try searching our database.

How to read files from assembly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yoges - 22 Sep 2004 21:37 GMT
Hi,

I my .Net Class library project I have added the .xsl file. I need to get
the contents of the file by loading the Assembly Dll. Is there any way to
get the file contents.

Thanks and Regards,
Yogesh
Sayed Hashimi - 30 Sep 2004 13:06 GMT
Yogesh,

You can load files from your dll. Here are the steps:

1) Add the file to your dll. Right click on the file in Visual Studio
and choose Properties. You need to set the "Build Action" property to
"Embedded Resource".
2) Compile the assembly; this will embed the file into your dll.
3) To load the assembly, you can do Assembly.Load(); This will give
you an Assembly reference. Note if you are loading the xsl file from
within the same assembly, you can use Assembly.GetExecutingAssembly().
4) Use the assembly reference to get a stream to the xsl file. You can
do this by calling the GetManifestResourceStream() method. Here is an
example:

Assembly.GetExecutingAssembly.GetManifestResourceStream("com.abc.file.xsl");

Note that you have to supply the fully qualified file name.

sayed

> Hi,
>
[quoted text clipped - 4 lines]
> Thanks and Regards,
> Yogesh

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.