-
May 22nd, 2012, 06:01 PM
#1
Modifying app.config
Hi,
I am trying to modify my app.config file during setup using Visual Studio 2010.
The setting I want to modify is:
<setting name="SageCRMSkypePlugin_CRMWebService_WebService" serializeAs="String">
<value>http://servername/crmskype/eware.dll/WebServices/SOAP</value>
</setting>
I've tried a lot of different methods and can't get it to work, see below.
I would appreciate any help you could give
Code:
string targetDirectory = Context.Parameters["targetdir"];
string param1 = Context.Parameters["Param1"];
//string param2 = Context.Parameters["Param2"];
//string param3 = Context.Parameters["Param3"];
//System.Diagnostics.Debugger.Break();
string exePath = string.Format("{0}SageCRMSkypePlugin.exe", targetDirectory);
Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
CRMSkypePlugin.Properties.Settings.Default["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
//CRMSkypePlugin.Properties.Settings.Default.SageCRMSkypePlugin_CRMWebService_WebService
CRMSkypePlugin.Properties.Settings.Default.SageCRMSkypePlugin_CRMWebService_WebService = param1;
CRMSkypePlugin.Properties.Settings.Default.Save();
//CRMSkypePlugin.Properties.Settings.Default.PropertyValues["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
//config.AppSettings.Settings["web"].Value = param1;
//var settings = config.GetSection("CRMSkypePlugin.Properties.Settings") as AppSettingsSection;
//settings.Settings["SageCRMSkypePlugin_CRMWebService_WebService"].Value = param1;
//CRMSkypePlugin.Properties.Settings.Default.PropertyValues["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
//["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
System.Configuration.ConfigurationManager.AppSettings.Set("SageCRMSkypePlugin_CRMWebService_WebService",param1);
// System.Configuration.DefaultSettingValueAttribute
//["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
//ConfigurationSettings.AppSettings["SageCRMSkypePlugin_CRMWebService_WebService"] = param1;
//config.AppSettings.Settings["SageCRMSkypePlugin_CRMWebService_WebService"].Value = param1;
//config.AppSettings.Settings["Param2"].Value = param2;
//config.AppSettings.Settings["Param3"].Value = param3;
//config.AppSettings.Settings.Remove("SageCRMSkypePlugin_CRMWebService_WebService");
//config.AppSettings.Settings.Add("SageCRMSkypePlugin_CRMWebService_WebService", "http://davidhendrick/crmskype/eware.dll/WebServices/SOAP");
config.Save();
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|