windows services - How do I alter a .NET application/user settings on installation? -


In a Windows service project, I tried the following with a project installer:

 < Code> [RunInstaller (true)] Public Partial Classroom ProjectInstaller: Installer {Public ProjectInstaller () {InitializeComponent (); } Safe Override Zero OnBeforeInstall (System.Collections.IDictionary SavedState) {base.OnBeforeInstall (savedState); Settings.default.setting = "now"; Settings.Default.Save (); } Safe Override Zero OnAfterInstall (System.Collections.IDictionary SavedState) {base.OnAfterInstall (SavedState); Settings.default.setting = "now"; Settings.Default.Save (); }}  

But when I look at the .config file after installation, there is still a old value still there. There was no .config file in the [userfolder] \ AppData \ Local

, it is important for me to define this variable in the installation time because I can get it from user input in the Setup Setup project. Continuous value is used only for testing purposes.

Framework will not allow you to change settings unless the application settings are read-only and Unless the service is started and a user name (under user name) runs, there is no user reference.

The only solution is that I manipulate the SQL XML file and I override the installation method and make the changes in the file itself.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -