Using CurrentDomain.SetData(“APP_CONFIG_FILE”) doesn't work in PowerShell ISE

前端 未结 2 776
暗喜
暗喜 2020-12-31 18:11

I\'m attempting to use a .NET 4.0 assembly in PowerShell ISE, and trying to change the config file which is used via:

[System.AppDomain]::CurrentDomain.SetDa         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 18:41

    Taking off [0] works for me.

    ([Configuration.ConfigurationManager].Assembly.GetTypes() | where {$_.FullName -eq "System.Configuration.ClientConfigPaths"}).GetField("s_current", "NonPublic, Static").SetValue($null, $null)

提交回复
热议问题