How to set a config/property on a program without recompiling to change a setting on GUI

Hello every1,

I have a current program where I added a setting in the config where it hides some tabs and file menus depending on a boolean value. I would like to be able to turn this config setting on/off without having to recomplile and republish the program. What would be the best way to do something in this nature? What would you guys suggest? Maybe an external XML file and and set the property: Copy to Output = Copy Always?

In a diff program I created a debug log txt file and once I published and installed the program the log is no where to be found. So I am just curious where this would go after I installed the program and so a user without technical knowledge could easily change this file and that would adjust the settings on the program.

My current setting I put in -
But I cant find this file after installing the published program.

Do you want the change to take affect right away (if changed when the app is running) or just on next start of the application?

If you are ok with it being the next time the application starts, then I would add a config file with that setting, and make sure that it gets deployed with the app.


In my projects I have a configuration file with extension .config and internal xml configuration.

Every time a user logs on to a web application or a windows service or console application they start, the file is read and deserialized into a custom class with various properties.

The class can contain properties where to store configuration of databases, roles, users, … This class would be static and can be read from any point of the application and apply it to the authenticated user or started service.

I hope it helps.

1 Like

Hello guys thank you for the feedback. I’m still not 100% sure about this. I would like the input to be able to read right away, as soon as it is changed. I’m currently using the ‘Properties-Settings-Default’ to hold some data in variables for the program. 1 of my settings is a simple boolean and it displays certain Menu Items and Tabs on the program whether the user has access to this or not. Is this the right way to do such a thing? Using the default properties-settings on the program are those being read on runtime? if the program is running and 1 of those properties change will it take affect right away? or would the application have to restart? I also have another variable in the settings which stores a file directory path and this is the location of a vault. If the user changes this path I would like the treeview (vault) to be able to change. Maybe this will help you guys understand what i’m looking for.public string VaultPath { get; set; } = Properties.Settings.Default.PDFVault;


First of all, is your application web or desktop application?

  1. If the application is web, any change in the application on the server side: change of web.config, properties file, … will cause a restart to the users to refresh the cache and obtain the new configuration values.

  2. If your application is desktop, a change in the properties file can force the value to be refreshed using: ApplicationSettingsBase.Reload. Causes the configuration reload. You could put the previous function in the functionalities that you need to read and have the properties live the configured value. More info:


It’s a desktop App.
I’ll try that applicationSettingsBase.Reload after a config property is saved. That would be exactly what I’m looking for if it refreshes the program and takes the new settings!

Just use properties.settings. You can change each property at runtime. Don’t forget to call the save-method

So that is what I wanted to use, The default Properties.
But now my boss is against that because when I install the program how the default installation is so far in %AppData\Local\Apps\2.0\45td3dt.43s\FolderOfApp
He wants the properties to be located in the default C\ProgramsFile\ folder.
To do this is my best approach to build a custom XML document that will be here?
Or is there a way I can change the install directory of the program?

You cannot locate the properties/configs in C:\ProgramFiles\ ~ because the files there are
Changing the install directory is a matter of your installation tool. Of course you can choose another

I have only used the default installation on a .Net project.
Do you know how to change the directory on the install tool, is there a way using the default installation? Or do I need to find a 3rd party installation tool to do such a thing?

You can change the directory of a Net-Project in Visual Studio:
Tab [ Project ] --> folder to publish --> select an other target --> publish --> done
As 3rd party tool i recommend Inno-Setup.

.NET Foundation Website | Blog | Projects | Code of Conduct