views:

561

answers:

9

Is there anyway to combine all resources into a single exe file such as app.config and associated DLL's?

Some applications seem to do this such as eMule.

I don't want my app.config sitting there waiting to be edited.

Thanks

A: 

I have used Thinstall as an application virtualization shrinkwrapper before:

https://thinstall.com/help/index.php?_netsupport.htm

This does what you want, i.e. bundles all your app's dependencies into one exectuable, including the .configs.

You would also do well researching other software shrink-wrap tools.

Dan
+2  A: 

You can of course embed resources. Go to the application properties and select the "Resources" tab. All resources added in their will be in the main binary.

Why not have app.config sitting there waiting to be edited? Many professional software packages have configuration and ini files freely there to be edited.

Vincent McNabb
+5  A: 

Certainly, in the Solution Explorer (assuming Visual Studio here, since you don't mention) Right-click and Properties of the file(s) you want included.

There should be an option there for Build Action which you can set to Embedded Resource.

Mark Glorie
A: 

If you don't want settings to be changed move them into the code rather than config.

benPearce
A: 

I agree with some of the users. It defeats the purpose of "config", really. Just hard code all the info in a shared class call "settings" and then reference like

_serverIP = settings.MailServerIP

The only items which should be considered are helperfiles (which relates to something, per say), images, 3rd party dlls (I am not sure of this though)...to name a few.

Saif Khan
A: 

The problem with the .net app.config files is that modifying them can change the way an application works.

Embedding resources is not a problem, its that particular file which I'm worried about.

Sir Psycho
Then you probably don't understand how resources work. You can use resources in lieu of your app.config. It's that simple.
Jon Limjap
A: 

Thinstall looks very interesting. Vorpal, have you encountered any issues when deploying app with 3rd party dlls?

Thanks

Saif Khan
I've added 3rd party libs with no problem.
Dan
+1  A: 

Dude, That's why it's a config file! It's supposed to allow you to change the way an app works on-d-fly b!

If you are concerned about your settings, which shouldn't be altered, then try another storage, class, database, registry, flatfile etc, or just keep a replica somewhere which can be used to replace the screwed up one.

Saif Khan
+1  A: 

Merging dlls - ILMerge

Merging config file is not worth it, since it is supposed to be way to tweak the app behavior without recompiling it. If you do not need that - just hardcode everything (either the code or as EmbeddedResources).

If you do still need configurability, you can hide the file into the user profile.

See, for example, http://www.codeproject.com/KB/cs/SystemConfiguration.aspx

Rinat Abdullin