PowerShell App.Config

前端 未结 3 1691
醉梦人生
醉梦人生 2020-12-04 22:16

Has anyone worked out how to get PowerShell to use app.config files? I have a couple of .NET DLL\'s I\'d like to use in one of my scripts but they expect their

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 22:44

    I'm guessing that the settings would have to be in powershell.exe.config in the powershell directory, but that seems to be a bad way of doing things.

    You can use ConfigurationManager.OpenMappedExeConfiguration to open a configuration file based on the executing DLL name, rather than the application exe, but this would obviously require changes to the DLLs.

提交回复
热议问题