I'm working on a project in SP/VS2010 that contains features with event receivers that require access to appsettings keys in the web application's web.config.
While I've checked that the features can acces these keys when (e.g.) activated from the web UI, they do not have access when activated via VS's Build > Deploy Solution menu item or via powershell.
I've established that this is because when the featre is activated by VS or Powershell, the call to ConfigurationManager.AppSettings in the feature receiver does not correspond to the web application's web.config. Instead, it corresponds to vssphost.exe's .config or powershell.exe's .config respectively.
While I can probably throw together a Powershell script to copy the required keys to powershell.exe.config before I try to use these features via PS, I can't think of a neat way to do copy the keys to vssphost4.exe.config every time I use Build > Deploy Solution in VS2010.
I can't be the only person with this issue, but I've been unable to find anything via Google. Is there a standard way to do this?