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

Blazor Web App (.NET 8 preview 7) - Identity Scaffolding #2510

Open
1 task done
clockwiseq opened this issue Aug 30, 2023 · 8 comments
Open
1 task done

Blazor Web App (.NET 8 preview 7) - Identity Scaffolding #2510

clockwiseq opened this issue Aug 30, 2023 · 8 comments

Comments

@clockwiseq
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Per the documentation:

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-8.0&tabs=visual-studio#scaffold-identity-into-a-razor-project-without-existing-authorization

Added Data Context:

image

Added Existing User Class:

image

Every time, I get this:

image

Expected Behavior

All Identity pages scaffolded along with a new DbContext

Steps To Reproduce

  1. Create new Blazor Web App (I think this template is new using 2022 Preview)
  2. Right-click project and select Add Scaffolded Item
  3. Select all to override all pages
  4. Click + to create new DbContext
  5. Click + to create new IdentityUser
  6. Click Add

Exceptions (if any)

No response

.NET Version

8.0.100-preview.7.23376.3

Anything else?

D:\Projects\Tests\DotNet8BlazorWebApp\BlazorApp1\BlazorApp1>dotnet --info
.NET SDK:
Version: 8.0.100-preview.7.23376.3
Commit: daebeea8ea

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\

.NET workloads installed:
There are no installed workloads to display.

Host:
Version: 8.0.0-preview.7.23375.6
Architecture: x64
Commit: 65b696cf5e
RID: win-x64

.NET SDKs installed:
7.0.306 [C:\Program Files\dotnet\sdk]
7.0.400 [C:\Program Files\dotnet\sdk]
8.0.100-preview.7.23376.3 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-preview.7.23376.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

D:\Projects\Tests\DotNet8BlazorWebApp\BlazorApp1\BlazorApp1>

@MackinnonBuck MackinnonBuck transferred this issue from dotnet/aspnetcore Aug 30, 2023
@deepchoudhery
Copy link
Member

Hey,
Have been actively working to fix this issue, should be fixed for the upcoming release.

Thanks,
Deep

@retailonline
Copy link

Same problem in .NET 8.0.0-rc.1.

@yorjo
Copy link

yorjo commented Sep 14, 2023

Same problem in .NET 8.0.0-rc.1.

I had the same problem.
I succeed to do it by using the .NET CLI instead of the Visual Studio. It seems it's when we define the DbContext. Without it, it works well.

Not working :
dotnet aspnet-codegenerator identity -dc OCuverie.Data.OCuverieAuthContext --files "Account.Register;Account.Login;Account.Logout"

Working :
dotnet aspnet-codegenerator identity --files "Account.Register;Account.Login;Account.Logout"

@jarmstrong52
Copy link

After commenting out app.MapRazorComponents(); in Program.cs, the scaffolding worked.

@retailonline
Copy link

After commenting out app.MapRazorComponents(); in Program.cs, the scaffolding worked.

Did not work for me using "Blazor Web App" project template under .NET 8.0.0-rc.1.

@jarmstrong52
Copy link

After commenting out app.MapRazorComponents(); in Program.cs, the scaffolding worked.

Did not work for me using "Blazor Web App" project template under .NET 8.0.0-rc.1.

Also needed to comment out using .Components. You end up with razor pages and a directory structure that needs work. Probably not that useful in a Blazor app.

@deepchoudhery
Copy link
Member

Hey,
I just merged a fix for this, will be available in 8.0.0-rc2.

@Capersjr-Dev
Copy link

Is there a work around while we are waiting for 8.0.0-rc2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants