Scaffolding failing for identity in blazor

NOVATROOP77 256 Reputation points

When I try to add identity thru the cli cause the tooling is broken form the gui I get this error. I am using Blazor / Client Server. I persume I would scaffold my identity pages to the client.

Inference.targets(188,5): error NETSDK1032: The RuntimeIdentifier platform 'browser-wasm' and the PlatformTarget 'x64'
must be compatible.

I am running the scaffolding via this method

dotnet aspnet-codegenerator identity

As when I run it from the GuI it throws an error.

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
984 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,213 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce ( 36,421 Reputation points

    Blazor Client (WASM) projects do not support database scaffolding as the browser does not have database support.

    A blazor client would typically use oauth, and the login server project would be the one to support identity database scaffolding. That is the clamor client would call a login server and get a JWT token, that it passed as a bearer token when calling a webapi.

    Note. If you used cookie authentication, the the host of the index.html static file would implement cookie authentication.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Bruce ( 36,421 Reputation points

    Blazor client apps are a static web site. The blazor code can use HttpClient to call a login service to get a token (or use an iframe and host an open api login page).

    to have a login server you create a separate core project to be the login server. you add this to the solution. as the blazor project is a static website, the server project can host, instead of a separate webserver.

    you can manually deploy the blazor project to the server project wwwroot or use the new combined project (which nests the blazor project in the server project).

    0 comments No comments