Howto: Include text data in a .net executable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ola Theander

    #1

    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


  • Kirby Turner

    #2
    Re: Howto: Include text data in a .net executable?

    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"
    <ola.theander@o tsystem.com> wrote:
    [color=blue]
    >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
    >[/color]

    --
    Kirby Turner, MCSD, MCAD
    White Peak Software helps startups and small businesses build amazing apps. Family owned and operated since 2003.

    Comment

    Working...