我有一个app.config文件,它包含以下
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name ="PowershellSnapIns" type ="System.Configuration.DictionarySectionHandler,System"/>
</configSections>
<PowershellSnapIns>
<add key="SnapIn1" value="WebAdministration" />
<add key="SnapIn2" value="Jimmy Hendrix" />
<add key="SnapIn3" value="..." />
</PowershellSnapIns>
</configuration>
我将使用ConfigurationSettings类读取它,但这已被弃用。 这是使用相当简单。 现在,我必须使用ConfigurationManager中类,我现在有这样的代码读取它。
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
IDictionary SnapInList = (IDictionary) config.GetSection("PowershellSnapIns");
但它一直示数出来。 我改变了的app.config性能跨越到构建复制,但它不断接受,它无法找到该文件。 例外的说,它在寻找TestConsole.vshost.exe.config
。 是否vs2k8sp1现在为您自动重命名的app.config,如果是的话,我究竟做错了什么? 当然我并不需要重命名app.config文件调试虚拟主机。 我知道在新闻稿中它可能被改名TestConsole.exe.config
。 那么是什么回事? 难道是代码错误或什么情况下?