Single Exe - No install program - Storing Settings

  • Thread starter Thread starter pbcoder
  • Start date Start date
P

pbcoder

Hi,

I have been asked to create a solution in a single exe - using C# .NET 3.5.

I have found that I can us ILMerge to create a single exe of all of my
Application assemblies.

But my question is what to do about settings/config?

I have some settings should be settings which should be shared between
instances of the application but these settings could be changed by the user
overtime.

This is why I would not use the registy - let the user specify the settings
at first run.

Thanks in advance.

Lars
 
Well you arent going to easily be able to recompile your app to change user
settings at runtime so I would suggest that an XML file or the registry are
the best way to go.
 
I normally use xml or registy to store setting, but

The point about the application is that it should be easy to copy between
users simply by copy one file not have to copy several files - I know it
might be difficult/impossible thing to achieve.

Lars
 
If these users are in a corporate network then you should look at have a
central file somewhere they can all access, or if they are spread out over
the net then potentially a webservice where they can get the settings. It is
quite ellaborate to do that but you are asking for a difficult thing. The
settings will have to be somewhere.
 
Well unfortunately the users will not be on the same coporate network or may
not even have a network connection.

Could I have the settings as an embedded rescource and the alter it when
needed?

Lars
 
Embedded resources are embedded into your application so you would need to
dissasemble the app, edit the settings file and reassemble it. Then work out
a way to replace the file which the application is still running.

Good luck with that, it will be impressive when you have finished
 
Ok - that sounds like a job for the weekend ;-).

I'll see if the my customer might change the requirements for the particular
appllication, since this is going to take some time to acheive.

Thank you for your time Ciaran
 
On reflection, you could possibly make the app a self extracting zip file
which extracts the EXE and a settings file and then starts the app, then when
you app closes, it can repack the settings file and itself into the exe. You
would probably want a tool for this bit which could be in the zip too.
So the app isnt single exe when running but when not running, it is.
Just an idea for you to think about.
Another option would possibly be to figure out whether you can access any
part of the exe file directly and modify some of it. Possibly add a few bytes
at the end which you can treat as structure storage and write the settings
to. I dont remember if the framework will checksum the exe when it loads it
or if this only happens for strong named assemblies.
 
pbcoder said:
Hi,

I have been asked to create a solution in a single exe - using C#
.NET 3.5.

I have found that I can us ILMerge to create a single exe of all of
my
Application assemblies.

But my question is what to do about settings/config?

I have some settings should be settings which should be shared
between
instances of the application but these settings could be changed by
the user overtime.

This is why I would not use the registy - let the user specify the
settings at first run.

Thanks in advance.

Uh, why does using the registry preclude letting the user specify the
settings on the first run?
 
Hi Ciaran,

excellent idea about the zip file - i think i will proceed with that idea.

Thank you for your inputs.
 
Hi,

Well, using the registry does not preclude the user from specifying settings
at first run - sorry for my english writting - but the way that appliaction
is going to be deployed - means that the registry is the best storage for
settings.

Lars
 
Back
Top