* show VS for managing user secrets /a
* show VS for managing user secrets /a
* show VS for managing user secrets /a
* Update aspnetcore/security/app-secrets.md
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Addresses #8579
I might be getting the hang of **_find and replace_** now. 😝
This doesn't touch a couple that ref 2.2.0. I'll tidy those up on https://github.com/aspnet/Docs/issues/8518 after 2.2 RTM.
Fixes#6523
[Internal Review Topic](https://review.docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-1.0&branch=pr-en-us-6528)
Tiny nits in the app secrets update: "or later" and a couple of comma splices.
What I wrote for another version of this was more explicit. I'm concerned that the current version doesn't tell devs exactly why/how `AddUserSecrets` is added, and it doesn't say that if `CreateDefaultBuilder` isn't used that they'll still need to do it manually.
Starting with ...
> \- Add the user secrets configuration source to the `Startup` constructor:
> Add the user secrets configuration source with a call to \[AddUserSecrets](/dotnet/api/microsoft.extensions.configuration.usersecretsconfigurationextensions.addusersecrets) in the `Startup` constructor:
>
> \[!code-csharp\[](app-secrets/samples/1.1/UserSecrets/Startup.cs?name=snippet_StartupConstructor&highlight=5-8)]
> ::: moniker-end
> ::: moniker range=">= aspnetcore-2.0"
> When a project calls \[CreateDefaultBuilder](/dotnet/api/microsoft.aspnetcore.webhost.createdefaultbuilder) to initialize a new instance of the host with preconfigured defaults, \[AddUserSecrets](/dotnet/api/microsoft.extensions.configuration.usersecretsconfigurationextensions.addusersecrets) is called when the \[EnvironmentName](/dotnet/api/microsoft.aspnetcore.hosting.ihostingenvironment.environmentname) is \[Development](/dotnet/api/microsoft.aspnetcore.hosting.environmentname.development):
>
> \[!code-csharp\[](app-secrets/samples/2.1/UserSecrets/Program.cs?name=snippet_CreateWebHostBuilder&highlight=2)]
>
> When `CreateDefaultBuilder` isn't called during host construction, add the user secrets configuration source with a call to \[AddUserSecrets](/dotnet/api/microsoft.extensions.configuration.usersecretsconfigurationextensions.addusersecrets) in the `Startup` constructor:
>
> \[!code-csharp\[](app-secrets/samples/1.1/UserSecrets/Startup.cs?name=snippet_StartupConstructor&highlight=5-8)]
> ::: moniker-end
Snippet the call to `CreateDefaultBuilder` to show it (line 2 is highlighted) ...
```csharp
#region snippet_CreateWebHostBuilder
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
#endregion
```
... and the sample naming issue remains ("1.1" and "2.1" instead of "1.x" and "2.x").
If anything here looks good, I can mod this branch to make additional updates. Otherwise, nevermind. Just spit-ball'in here.