How can I change what the App.config is renamed to?

I have an App.config file in my project that is copied to NameOfExe.exe.config at build time. Users of my software will need to edit this file from time to time, but they may not be familiar with how .NET does things (or how computers do things in general). I think that using a filename like this might confuse them, with the extension .exe.config, etc.

How can I give a new name for this copied file (remove the .exe bit)? Should I use the custom build command? Also, will .NET be collected in a config file or is this required by the naming scheme?

EDIT: In response to suggestions to revise ... the app acts as a service or console app, so there is no GUI to edit the settings. The configuration file contains parameters used to connect to the database and API service. These values ​​should not change after the initial setup for each client (this is done by me). In the unlikely event that the values ​​need to be changed, the client will need to call me to get the new connection data anyway, so I can review it, what needs to be edited and how to do it. I just wanted to avoid confusion when I tell the client that they need to open a file called ".exe.config" and then they run the ".exe" file by mistake. Also, if they need to run the .exe file and enable "Hide extensions of known file types ", some might try to open the config file and then call me wanting to know why they instead get a Notepad window filled with strange text.

Of course this is not required, but I like to plan ahead.

+2


source to share


3 answers


I agree with psychotik that you should rethink the concept of creating your users in the software config file, but you can use this alternative:

External config file can be referenced



<appSettings file="otherlessconfusingname.config" />

      

+6


source


Before anyone tells you how to change it (which is possible and quite simple), I encourage you to reconsider.



If your users are other people like developer, using .exe.config is fine. If they are consumers, they shouldn't mess with .exe.config or other xml-like files. You must specify another means to customize the application (settings).

+2


source


If your users are having problems with the file name or extension, how will they deal with the XML within it?

Instead of wasting your energy figuring out if you can rename the file, give users a friendly graphical interface that they can use to change the appropriate configuration.

+2


source







All Articles