Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prep monikers for scaffold identity #23967

Merged
merged 3 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions aspnetcore/includes/scaffold-identity/id-scaffold-dlg-auth.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
---
::: moniker range=">= aspnetcore-3.0"
::: moniker range=">= aspnetcore-6.0"

Run the Identity scaffolder:

Expand Down Expand Up @@ -67,7 +67,7 @@ If you run the Identity scaffolder without specifying the `--files` flag or the

::: moniker-end

::: moniker range="< aspnetcore-3.0"
::: moniker range="< aspnetcore-6.0"

Run the Identity scaffolder:

Expand All @@ -76,9 +76,9 @@ Run the Identity scaffolder:
* From **Solution Explorer**, right-click on the project > **Add** > **New Scaffolded Item**.
* From the left pane of the **Add Scaffold** dialog, select **Identity** > **Add**.
* In the **Add Identity** dialog, select the options you want.
* Select your existing layout page, or your layout file will be overwritten with incorrect markup. When an existing *\_Layout.cshtml* file is selected, it is **not** overwritten. For example:
* `~/Pages/Shared/_Layout.cshtml` for Razor Pages
* `~/Views/Shared/_Layout.cshtml` for MVC projects
* Select your existing layout page so your layout file isn't overwritten with incorrect markup. When an existing *\_Layout.cshtml* file is selected, it is **not** overwritten. For example:
* `~/Pages/Shared/_Layout.cshtml` for Razor Pages or Blazor Server projects with existing Razor Pages infrastructure
* `~/Views/Shared/_Layout.cshtml` for MVC projects or Blazor Server projects with existing MVC infrastructure
* To use your existing data context, select at least one file to override. You must select at least one file to add your data context.
* Select your data context class.
* Select **Add**.
Expand All @@ -96,11 +96,15 @@ If you have not previously installed the ASP.NET Core scaffolder, install it now
dotnet tool install -g dotnet-aspnet-codegenerator
```

Add a package reference to [Microsoft.VisualStudio.Web.CodeGeneration.Design](https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/) to the project file (*.csproj*). Run the following commands in the project directory:
Add required NuGet package references to the project file (*.csproj*). Run the following commands in the project directory:

```dotnetcli
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet restore
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore
dotnet add package Microsoft.AspNetCore.Identity.UI
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools
```

Run the following command to list the Identity scaffolder options:
Expand All @@ -109,6 +113,8 @@ Run the following command to list the Identity scaffolder options:
dotnet aspnet-codegenerator identity -h
```

[!INCLUDE[](~/includes/scaffoldTFM.md)]

In the project folder, run the Identity scaffolder with the options you want. For example, to setup identity with the default UI and the minimum number of files, run the following command. Use the correct fully qualified name for your DB context:

```dotnetcli
Expand Down
Loading