I recently got a new laptop from my employer and had to setup my dev environments again. As part of that, I thought it would be nice if I could get all the user secrets I had stored for the .NET Core projects to the new laptop too. Some of those settings I would need to modify, but there was very few of them.

Turns out it is pretty easy to move user secrets. All of the user secret JSON files are stored in a single folder. On Windows it is %APPDATA%\Microsoft\UserSecrets, and on Linux/MacOS it is ~/.microsoft/usersecrets.

All you need to do is take all of those JSON files and put them in the same folder on the other machine. And you are done!

This does raise the point again that user secrets isn't really a secret store. It uses un-encrypted JSON files stored in a folder that is not part of your project folder. The main usefulness comes from the fact that you can't accidentally commit them to version control. And they also enable per-developer settings. The name might not be the best one :)

Links