【发布时间】:2012-11-05 09:53:07
【问题描述】:
我正在尝试在 PowerShell ISE 中使用 .NET 4.0 程序集,并尝试更改通过以下方式使用的配置文件:
[System.AppDomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $PathToConfig);
[Configuration.ConfigurationManager]::ConnectionStrings.Count 总是返回“1”,
和“[Configuration.ConfigurationManager]::ConnectionStrings[0].Name”总是返回“LocalSqlServer”,而那个 ConnectionString 名称不是在我的“.config”文件中。
请注意,从 PowerShell 命令提示符执行 PowerShell 脚本会按预期运行。只是当我从 PowerShell ISE 中执行它时,它没有按预期工作。
【问题讨论】:
标签: .net-4.0 windows-8 powershell-3.0 powershell-ise