Adding file to exe on the fly

C

CSharper

I have an exe. When one of admin runs it creates a file. This file is
required for the exe to run when we deliver to client. Is it possible
to add the file into the exe when the admin runs instead of
recompiling the code?
In otherwords, is it possible to add a file to the exe or add a
resource to the executing exe?
Thanks,
 
J

Jon Skeet [C# MVP]

CSharper said:
I have an exe. When one of admin runs it creates a file. This file is
required for the exe to run when we deliver to client. Is it possible
to add the file into the exe when the admin runs instead of
recompiling the code?
In otherwords, is it possible to add a file to the exe or add a
resource to the executing exe?

It's possible, but it would be relatively tricky. Why not just keep the
file separate but in the same directory?
 
J

Jon Skeet [C# MVP]

CSharper said:
We wanted to ship only one file out (management requirement). Thanks
and could you please tell me how to go about doing it?

Find the format of the exe file (PE format) and rebuild it all. It'll
be a massive pain though. I would strongly urge you to ask management
just how much they want this.
 
C

CSharper

J

Jon Skeet [C# MVP]

Is it possible to to have a place holder in the file and then replace
the content of the file later somehow? My other option is to use
ILMerge.

Either of those *might* work - but you'll need to look into the PE
format and dig around to find out for sure.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top