前提・実現したいこと
app.configの情報を書き換えたい。
発生している問題・エラーメッセージ
値が変わらない
該当のソースコード
c#
1using System.Configuration; 2private void btnCommit_Click(object sender, EventArgs e) 3{ 4 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 5 config.AppSettings.Settings["SVName"].Value = txtServerName.Text; 6 config.Save(); 7 Close(); 8}
app.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> </startup> <appSettings> <add key="SVName" value="value1" /> </appSettings> </configuration>
試したこと
https://techbox.work/archives-77/
の
4.設定値の保存
を参考にしています
補足情報(FW/ツールのバージョンなど)
C#
Visual Studio 2015
app.configも見せてください。
回答2件
あなたの回答
tips
プレビュー