{"action":"created","issue":{"url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/1","repository_url":"https://api.github.com/repos/TOAD-CODE/PowerColleague","labels_url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/1/comments","events_url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/1/events","html_url":"https://github.com/TOAD-CODE/PowerColleague/issues/1","id":150879976,"number":1,"title":"Add-Type error with PowerShell 5 on Windows 7","user":{"login":"rogergarrison","id":12206143,"avatar_url":"https://avatars.githubusercontent.com/u/12206143?v=3","gravatar_id":"","url":"https://api.github.com/users/rogergarrison","html_url":"https://github.com/rogergarrison","followers_url":"https://api.github.com/users/rogergarrison/followers","following_url":"https://api.github.com/users/rogergarrison/following{/other_user}","gists_url":"https://api.github.com/users/rogergarrison/gists{/gist_id}","starred_url":"https://api.github.com/users/rogergarrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogergarrison/subscriptions","organizations_url":"https://api.github.com/users/rogergarrison/orgs","repos_url":"https://api.github.com/users/rogergarrison/repos","events_url":"https://api.github.com/users/rogergarrison/events{/privacy}","received_events_url":"https://api.github.com/users/rogergarrison/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-25T14:28:27Z","updated_at":"2016-04-25T22:26:28Z","closed_at":null,"body":"Upgraded to PowerShell 5 on Windows 7 from PowerShell 4 and now I receive errors with Add-Type. \r\n[EDIT]\r\n~~The root cause of the error seems to be on Line 25~~\r\n```powershell\r\n[System.AppDomain]::CurrentDomain.SetData(\"APP_CONFIG_FILE\", $AppConfigPath)\r\n```\r\n\r\n~~is not actually setting the app config correctly. So~~ when I try to read the AppSettings out of the config, it returns $null\r\nThus when it returns $null it sets the path as the current working directory rather than the path specified in the AppSettings.\r\n\r\n[Update]\r\nI have confirmed that it is actually setting the app config just won't return the value for whatever reason.\r\n```powershell\r\n[System.AppDomain]::CurrentDomain.GetData(\"APP_CONFIG_FILE\")\r\n```\r\nreturns the expected App.config\r\nI can also do\r\n```powershell\r\n$configFile = [System.Configuration.ConfigurationManager]::OpenExeConfiguration([System.configuration.ConfigurationUserLevel]::None)\r\n\r\n$configFile.AppSettings.Settings\r\n```\r\nthis returns the Keys and Values expected.\r\n\r\nbut \r\n```powershell\r\n[System.Configuration.ConfigurationManager]::AppSettings.count\r\n```\r\nreturns `0`\r\n"},"comment":{"url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/comments/214549714","html_url":"https://github.com/TOAD-CODE/PowerColleague/issues/1#issuecomment-214549714","issue_url":"https://api.github.com/repos/TOAD-CODE/PowerColleague/issues/1","id":214549714,"user":{"login":"rogergarrison","id":12206143,"avatar_url":"https://avatars.githubusercontent.com/u/12206143?v=3","gravatar_id":"","url":"https://api.github.com/users/rogergarrison","html_url":"https://github.com/rogergarrison","followers_url":"https://api.github.com/users/rogergarrison/followers","following_url":"https://api.github.com/users/rogergarrison/following{/other_user}","gists_url":"https://api.github.com/users/rogergarrison/gists{/gist_id}","starred_url":"https://api.github.com/users/rogergarrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogergarrison/subscriptions","organizations_url":"https://api.github.com/users/rogergarrison/orgs","repos_url":"https://api.github.com/users/rogergarrison/repos","events_url":"https://api.github.com/users/rogergarrison/events{/privacy}","received_events_url":"https://api.github.com/users/rogergarrison/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T22:26:27Z","updated_at":"2016-04-25T22:26:27Z","body":"The issue will also occur if you try to get the app.config before it's set on PowerShellv4\r\n```powershell\r\n[System.Configuration.ConfigurationManager]::AppSettings\r\n[System.AppDomain]::CurrentDomain.SetData(\"APP_CONFIG_FILE\", $AppConfigPath)\r\n[System.Configuration.ConfigurationManager]::AppSettings.Count\r\n```\r\n\r\nreturns `0`\r\n\r\nThis isn't a solution, but a hack to get it to work is to move the app.config file to `C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe.config`"}}