Commit Graph

7 Commits (ef2bee10ebc656de9b1b24c2bbb5db10794bf3fa)

Author SHA1 Message Date
Luke Latham b9c408f82a App secrets update (#6528)
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.
2018-05-22 13:43:02 -05:00
Scott Addie 8d6d49eb3b Update user secrets doc to 2.x (#6373)
* Update user secrets doc to 2.x

* Introduce another section for adding secrets

* More changes

* More changes

* Add CLI output

* Document more CLI command options

* Add installation note about .NET Core SDK 2.1

* More changes

* Indent code snippets within tabs

* Dedent code snippets

* Add code sample for AddEnvironmentVariables

* Fix code import

* Move text

* Improve examples

* Consolidate csproj files

* Add string replacement section

* Fix code snippet types

* Minor tweaks

* More changes

* Swap ordering of sections

* Move help command out of tabs

* Simplify installation instructions

* Indent command

* Simplification

* More simplification

* React to feedback
2018-05-16 13:33:38 -10:00
Rachel Appel f1271b218d update for .net core 2.0 (#4290)
* update for .net core 2.0

* edits

* edits

* code highlights

* cleanup

* tab changes; remove project.json
2017-09-15 14:13:19 +01:00
Nate McMaster 21f5d4ad35 Update the version of dotnet-user-secrets in sample documentation 2017-06-30 09:24:35 -07:00
Scott Addie b4c4f5a180 Provide Visual Studio instructions for installing Secret Manager (#3139) 2017-04-03 14:47:44 -10:00
Chad T db468e0cb3 Updated to use generic method of `AddUserSecrets` (#3023)
As the non-generic version is deprecated.
2017-03-20 21:01:16 -10:00
Rick Anderson 5caf86f9b2 add msbuild support to Secrets MGR (#2671)
* add msbuild support

* update 1

* csproj

* fix

* react to TD feedback

* fix TD

* final fix
2017-03-06 09:16:44 -08:00