473,566 Members | 3,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Howto: Include text data in a .net executable?

Dear subscribers

I'm currently creating a small application that will run at the end of a web
installation to configure a SQL Server. For this task I have a SQL batch
file in the same format as SQL Query Analyzer uses. I would prefer not to
merge the content of this file into the source code of configuration
application but instead keep the SQL commands in a text file included in the
executable, pretty much like resource data, for easy updates in the future.

My question is, what is the best way to attach text data to an .net
executable and still be able to extract it when the application is running?
What I want is to be able to do is to get the text data pretty much the same
way as if it was in a separate text file but with the difference that the
data is actually included in the executable.

Any help with this matter would be greatly appreciated.

Kind regards, Ola Theander
Jul 21 '05 #1
1 1766
I would include the file as an embedded resource in the assembly and
load the contents in as a stream at runtime. Get a reference to the
assembly containing the embedded resource and use the method
..GetManifestRe sourceStream() found on the Assembly class. Once you
have the resource as a stream, you can do as you please with the
content.

-KIRBY

On Thu, 19 Aug 2004 20:52:39 +0200, "Ola Theander"
<ol**********@o tsystem.com> wrote:
Dear subscribers

I'm currently creating a small application that will run at the end of a web
installation to configure a SQL Server. For this task I have a SQL batch
file in the same format as SQL Query Analyzer uses. I would prefer not to
merge the content of this file into the source code of configuration
application but instead keep the SQL commands in a text file included in the
executable, pretty much like resource data, for easy updates in the future.

My question is, what is the best way to attach text data to an .net
executable and still be able to extract it when the application is running?
What I want is to be able to do is to get the text data pretty much the same
way as if it was in a separate text file but with the difference that the
data is actually included in the executable.

Any help with this matter would be greatly appreciated.

Kind regards, Ola Theander


--
Kirby Turner, MCSD, MCAD
www.whitepeaksoftware.com
Jul 21 '05 #2

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

Similar topics

4
3830
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or less - during my own installation of Python 2.3 on Fedora Core 1 Linux for a friend of mine). Anyway, HTH, L.
11
9866
by: Matt | last post by:
I'm posting this question for one of my developers who's not quite as newsgroup-savvy. Any suggestions? The question follows, along with relevant source code. -Matt I have a templated queue class as part of a statically linkable library (in GQueue.h and .cpp below). The library compiles fine, but when I go to use it in an executable,...
5
7105
by: alejandro lapeyre | last post by:
How can I load / parse an HTML file with .NET? Thanks! Best regards, Alejandro Lapeyre
4
2839
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. '**************************************************************************** ' Issues '****************************************************************************
1
351
by: Ola Theander | last post by:
Dear subscribers I'm currently creating a small application that will run at the end of a web installation to configure a SQL Server. For this task I have a SQL batch file in the same format as SQL Query Analyzer uses. I would prefer not to merge the content of this file into the source code of configuration application but instead keep...
8
4167
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do this without .config file only with some configuration
1
2942
by: Marcel Brekelmans | last post by:
Hello, I know about the FileInfo.LastWriteTime() function. However, this is not always returning the modified date of the executable that I want: when you copy the executable to another directory the FileInfo.LastWriteTime() function returns the copy-time. I can see in my explorer that there is another modified time, the time when I...
7
24721
by: patrik.kahari | last post by:
Is there a c++ function similar to getcwd that does not give you the working directory but the directory or path of the currently running executable? I need this because im porting a game that uses relative paths to images. This works fine when the game is executed directly from the directory its in (as in ./game &). It does not work when...
3
7242
by: Mo | last post by:
Hi, Is there a way to include an executable (xxx.exe) file inside a c# console project so that the resulting project binary have only one final executable file? My c# console application is calling another Executable (exe) which I am trying to include in my project so I can only have one file for the executable. Any ideas? Mo
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.