473,468 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

embedded resources

i've created a custom installer that automates some things one of which is
the creation of database tables.

i have put a sql script ("automation.sql") as an embedded resource in the
custom installer project (whose name space is "installer"). here's the code
i'm using to get the script:

private function getEmbeddedText(byval fileName as string) as string
dim assemblyName as string
dim stream as stream
dim text as string
try
assemblyName = [assembly].getexecutingassembly.getname.name.tostring()
stream =
[assembly].getexecutingassembly.getmanifestresourcestream(as semblyName & "."
& fileName)
streamReader = new streamreader(stream)
text = streamReader.readtoend
catch ex as exception
dim message as string = "blah, blah, blah...sorry about that!"
msgbox(message, msgboxstyle.critical)
finally
if text is nothing then text = ""
if not stream is nothing then stream.close()
if not streamReader is nothing then streamReader.close()
end try
return text
end sub

yes, i'm purposely not checking to see if stream is nothing...for now while
debugging. i've tracked the error to this spot as getting the manifest
resource stream "installer.automation.sql" (whilst installing) does not give
me a stream (stream is nothing after the call) and the following line
generates the error.

i thought the reference to embedded resources where the host project's
assembly name...i.e. "installer" and not "Setup" (which is the exe that
kicks everything off. is there an error in the code that i'm overlooking or
do i need to reference the embedded resource differently?

tia,

steve

hey, also...is there a good way to step-through the installer class? i've
just been putting system.diagnostics.debugger.break() as the first line of
code for the base class afterinstall event and then attaching the current
ide to the process when it coughs up errors. surely there's got to be a
better way!

thanks again!
Nov 21 '05 #1
1 1215
never mind!

code works fine...it's my typing that sux! "automation.sql" instead of
"automatiion.sql". what a doof! ;^)

lol...cheers,

me

"steve" <a@b.com> wrote in message
news:10*************@corp.supernews.com...
| i've created a custom installer that automates some things one of which is
| the creation of database tables.
|
| i have put a sql script ("automation.sql") as an embedded resource in the
| custom installer project (whose name space is "installer"). here's the
code
| i'm using to get the script:
|
| private function getEmbeddedText(byval fileName as string) as string
| dim assemblyName as string
| dim stream as stream
| dim text as string
| try
| assemblyName = [assembly].getexecutingassembly.getname.name.tostring()
| stream =
| [assembly].getexecutingassembly.getmanifestresourcestream(as semblyName &
"."
| & fileName)
| streamReader = new streamreader(stream)
| text = streamReader.readtoend
| catch ex as exception
| dim message as string = "blah, blah, blah...sorry about that!"
| msgbox(message, msgboxstyle.critical)
| finally
| if text is nothing then text = ""
| if not stream is nothing then stream.close()
| if not streamReader is nothing then streamReader.close()
| end try
| return text
| end sub
|
| yes, i'm purposely not checking to see if stream is nothing...for now
while
| debugging. i've tracked the error to this spot as getting the manifest
| resource stream "installer.automation.sql" (whilst installing) does not
give
| me a stream (stream is nothing after the call) and the following line
| generates the error.
|
| i thought the reference to embedded resources where the host project's
| assembly name...i.e. "installer" and not "Setup" (which is the exe that
| kicks everything off. is there an error in the code that i'm overlooking
or
| do i need to reference the embedded resource differently?
|
| tia,
|
| steve
|
| hey, also...is there a good way to step-through the installer class? i've
| just been putting system.diagnostics.debugger.break() as the first line of
| code for the base class afterinstall event and then attaching the current
| ide to the process when it coughs up errors. surely there's got to be a
| better way!
|
| thanks again!
|
|
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: ...
5
by: Drew | last post by:
Assembly asm = Assembly.GetExecutingAssembly(); me = new Bitmap(asm.GetManifestResourceStream("me.gif")); I have used this before without any problem, but now I get: An unhandled exception...
0
by: Chris Schremser | last post by:
I have a question regarding embedded controls in IE. We are looking to replace a small VB ActiveX control with something written in C#. We have written the control and it instantiates correctly...
2
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML...
7
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to...
4
by: Jon Rista | last post by:
I have a project where I need to create a windows .exe by compiling code and linking in some resources. This program thats being generated is somewhat unconventional, and I'll explain how. I'm...
0
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have...
4
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .......
8
by: Fred* | last post by:
Hello, I'm using Visual C# 2005 Express. if I create a new "application windows" project and run it (F5), it works well. (an empty window is launched..) as soon as I set the build action to...
2
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.