.net的应用程序设置.exe.config怎么用啊?
发现生成的.exe文件旁有一个 .exe.config的XML文件
网上查是 应用程序配置 不过看了半天还是不了解怎么用
在IDE中通过 项目属性-设置 添加了两个设置
名称 DBHostName 类型 string 范围 Application 值 localhost
.exe.config 自动被修改为
<?xml version= "1.0 " encoding= "utf-8 " ?>
<configuration>
<configSections>
<sectionGroup name= "applicationSettings " type= "System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 " >
<section name= "WindowsApplication1.Properties.Settings " type= "System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 " requirePermission= "false " />
</sectionGroup>
</configSections>
<applicationSettings>
<WindowsApplication1.Properties.Settings>
<setting name= "DBHostName " serializeAs= "String ">
<value> localhost </value>
</setting>
<setting name= "UserID " serializeAs= "String ">
<value />
</setting>
</WindowsApplication1.Properties.Settings>
</applicationSettings>
</configuration>
请问在程序中怎么 读取 和 修改 DBHostName 这个项?
------解决方案--------------------一个运行时刻设置Web.config或App.config的类
http://blog.csdn.net/hertcloud/archive/2007/03/19/1533474.aspx
------解决方案--------------------app.config的一个映射
------解决方案--------------------项目里面有个Properties文件夹-> 点开“Setting.settings”前面的“+”,VS有生成一个读取和设置comfig文件的类ProjectName.Properties