Subsonic Access To App.Config Connection Strings From Referenced DLL in Powershell Script

后端 未结 1 1141
生来不讨喜
生来不讨喜 2021-01-20 11:35

I\'ve got a DLL that contains Subsonic-generated and augmented code to access a data model. Actually, it is a merged DLL of that original assembly, Subsonic itself and a few

1条回答
  •  醉话见心
    2021-01-20 12:10

    Did you add the System.Configuration assembly to your PowerShell session? The following works for me:

    PS> gc .\app.config
    
    
    
        
          
          
        
    
    
    PS> [appdomain]::CurrentDomain.SetData("APP_CONFIG_FILE", "$home\app.config")
    PS> Add-Type -AssemblyName System.Configuration
    PS> [Configuration.ConfigurationManager]::ConnectionStrings['Name']
    
    Name                    : Name
    ConnectionString        : Valid Connection String;
    ...
    

    0 讨论(0)
提交回复
热议问题