Using Secret Manager throws an Exception
If you are trying to use the Secret Manager with when developing an ASP.Net 5 application and it throws a FileNotFoundException saying
Could not load file or assembly 'Microsoft.Framework.ApplicationHost'
it’s probably due to a reference mismatch.
Since the release of Visual Studio 2015, there’s been a name change of the Secret Manager so when using a later DNX runtime version than beta-5 there’s a need to upgrade the Secret Manager as well.
Uninstall the old SecretManager
If the old Secret Manager was installed on the system using
dnu commands install SecretManager
Then uninstall the old one using
dnu commands uninstall SecretManager
If uninstalling using this command doesn’t work you can delete the pertinent files from %userprofile%\.dnx\bin.
Install the new SecretManager
Install the new SecretManager using
dnu commands install Microsoft.Framework.SecretManager
Happy coding! 🙂