I have an existing .Net 5 Blazor Server application. No authentication or authorization at this point. I am attempting to add Microsoft Identity via scaffolding but continue to get the the following error when I attempt to scaffold Identity into the project which I can not resolve "There was an error in the selected code generator 'Package restore failed. Rolling back package changes [MySolujtionName] Server."
Thing's I have tried:
So far no luck and I continue to get the same error.
I've tried with a new Blazor Server project and it works with:
then the scaffolding works as expected.
I obtain the following structure:
The User model class generated by the scaffolder will be:
namespace Test2.Areas.Identity.Data
{
// Add profile data for application users by adding properties to the Test2User class
public class Test2User : IdentityUser
{
}
}
I've found a bug in the Visual Studio Generator.
The only possibility to scaffold the Identity pages from an existing project is to execute the scaffolding process via command line.
Here is an example of the command line:
dotnet aspnet-codegenerator identity -dc TestWasmAuthIndividual.Server.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.Manage.PersonalData" --force
you need to execute this command line from the Server project.