App.configファイルを含むアプリケーションを作成し、セットアップウィザードプロジェクトを使用してWindowsインストーラを作成した。インストールされたアプリケーションを実行すると、完全に構成を読み取ることができますが、構成を変更して保存すると、アプリケーションがクラッシュするだけです。ここでApp.configを読むのはうまくいくが、アプリケーションをクラッシュさせて保存する。
は私のコードです:
Configuration applicationConfiguration =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Reading works just fine.
LogFilePath = applicationConfiguration.AppSettings.Settings["LogFilePath"].Value;
LogFilePath = "some string here";
applicationConfiguration.AppSettings.Settings["LogFilePath"].Value = LogFilePath;
// But saving it crashes the application. Only the .Save() line that making it crashed.
applicationConfiguration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
ここで間違っているものを任意のアイデア?原因ここdocummentationへ
"クラッシュ"を定義します。あなたは例外を見ていますか?もしそうなら、メッセージは何ですか? –