Hi sir,
Add settings keyvalue pair in app.config vb.net during installation
I want to add values in app.config during installation
My code is:
Imports System.ComponentModel
Imports System.Configuration
Imports System.Configuration.Install
Imports System.Reflection
<RunInstaller(True)>
Partial Public Class DBSinstaller
Inherits System.Configuration.Install.Installer
Public Sub New()
InitializeComponent()
End Sub
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
MyBase.Install(stateSaver)
licMode = Me.Context.Parameters.Item("LICENSEMODE").ToString()
MessageBox.Show(licMode)
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath)
config.AppSettings.Settings.Remove("LicenseMode")
config.AppSettings.Settings.Add("LicenseMode", licMode)
config.Save(ConfigurationSaveMode.Modified, True)
ConfigurationManager.RefreshSection("AppSettings")
End Sub
End Class
But it does not add values in settings.
Pls help me..
Thanks in advance