Member-only story

The Hidden Gems of .NET: Discovering User Secrets

Alex Maher
3 min readMar 17, 2023

--

User Secrets, sometimes referred to as the Secret Manager, have been part of the .NET ecosystem since .NET Core 2.0. Initially, they were seen as a potential risk for sharing sensitive information among developers. However, their true potential as a useful tool for local development configuration has gradually emerged. This article will dive into the process of creating and using User Secrets in .NET, discussing their appropriate applications and highlighting some additional information on the topic.

Creating User Secrets via Visual Studio

For those who prefer the convenience of an integrated development environment, Visual Studio offers a straightforward method for creating User Secrets. To get started, right-click your entry project and select “Manage User Secrets.” Visual Studio will take care of the rest, including installing any required packages and setting up the secrets file.

Creating User Secrets via Command Line

User Secrets can be created through the command line as well. To begin, run the following command in your project folder:

dotnet user-secrets init

This command generates a GUID and places it in your csproj file. After that, you can set secrets from the command line…

--

--

Alex Maher
Alex Maher

Written by Alex Maher

.NET C# dev with 10+ yrs exp, self-taught & passionate web developer. Sharing tips & experiences in C# and web dev.

No responses yet