Visual Studio .exe.config和.vshost.exe.config的差异
来源:互联网 发布:sql in和= 编辑:程序博客网 时间:2024/06/06 13:19
.exe.config :部署到客户端,通过.exe打开后使用配置文件,客户会用到的文件;
.vshost.exe.config : IDE通过F5打开后,宿主进程.vshost.exe打开程序所使用的配置文件,调试时用到的文件.
需要注意的是.vshost.exe.config文件在每次F5(启动调试)后都会刷新数据(取自APP.config).
//读写Config文件 /// <summary> /// 获取配置文件中key的值 /// </summary> /// <param name="key">键名</param> /// <param name="defaultvalue">默认值</param> /// <returns></returns> public static string GetConfig(string key, string defaultvalue) { string sRtn; Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); AppSettingsSection app = configuration.AppSettings; if (app == null || app.Settings == null || app.Settings.Count == 0) { sRtn = defaultvalue; SaveConfing(key, defaultvalue); } else { if (app.Settings[key] == null) { sRtn = defaultvalue; SaveConfing(key, defaultvalue); } else { sRtn = app.Settings[key].Value; } } return sRtn; } /// <summary> /// 保存配置文件 /// </summary> /// <param name="key">键名</param> /// <param name="value">值</param> public static void SaveConfing(string key, string value) { Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); AppSettingsSection app = configuration.AppSettings; foreach (string k in app.Settings.AllKeys) { if (k.Equals(key)) { app.Settings.Remove(k); } } app.Settings.Add(key, value); configuration.Save(ConfigurationSaveMode.Modified); }
0 0
- Visual Studio .exe.config和.vshost.exe.config的差异
- .exe.config和.vshost.exe.config的差异
- 宿主进程 [*.vshost.exe] & [*.vshost.exe.config]
- C#之app.config、exe.config和vshost.exe.config作用区别
- C#之app.config、exe.config和vshost.exe.config作用区别
- C#之app.config、exe.config和vshost.exe.config作用区别
- 【记录】宿主进程 [*.vshost.exe] & [*.vshost.exe.config]
- Visual Studio 不生成.vshost.exe和.pdb文件的方法
- Visual Studio 不生成.vshost.exe和.pdb文件的方法
- Debug目录、Release目录,bin目录、obj目录,vshost.exe.config文件、.exe.config文件分析
- Debug目录、Release目录,bin目录、obj目录,vshost.exe.config文件、.exe.config文件分析
- config.exe
- winform项目的app.config和exe.config文件
- winform项目的app.config和exe.config文件
- winform项目的app.config和exe.config文件
- Debug目录、Release目录,bin目录、obj目录,vshost.exe.config文件、.exe.config文件分析【C#】
- Debug目录、Release目录,bin目录、obj目录,vshost.exe.config文件、.exe.config文件分析【C#】
- Visual Studio 不生成.vshost.exe和.pdb文件的方法和 在VS2010中去掉ipch和sdf文件方法
- C++之(cin)与(!cin)的原理分析
- Torch初学(一)
- linux两台服务器间copy传输文件的最简单方法
- JS调试必备的5个debug技巧
- UnityPlayer.UnitySendMessage没有响应
- Visual Studio .exe.config和.vshost.exe.config的差异
- label自适应
- 网路神警上网行为管理系统 v3.4.5官方版
- python笔记
- ToolBar的使用详解
- 使用定时器实现简单的字体闪烁并实现字体跑马灯
- JDBC
- 嵌入式学习-uboot-lesson2-ARM相关知识
- Oracle 11g the account is locked问题的解决方法