Error scaffolding Identity Fails the second time after using CLI code generator

ThunderBox 0 Reputation points
2023-04-29T19:25:41.21+00:00

Hi I ran the code generator once to scaffold the login and register pages. Then I ran it again because I needed to scaffold the password page but it wouldn’t build and I got errors. I am using vs studio for Mac and the cli commands to scaffold pages.
Any help Is appreciated.

Here is the code I ran the first time: dotnet aspnet-codegenerator identity -dc TimeClock.Data.ApplicationDbContext --files "Account.Register;Account.Login”

Here is the code I ran the second time: dotnet aspnet-codegenerator identity -dc TimeClock.Data.ApplicationDbContext --files "Account.ForgotPassword"

Error I get

...error CS0433: The type 'SignInManager' exists in both 'Microsoft.AspNetCore.Identity, Version=7.0.0.0, Culture=neutral, PublicKeyToken=some# and 'Microsoft.AspNetCore.Identity, Version=2.0.4.0, Culture=neutral...

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | .NET | Blazor
Developer technologies | .NET | .NET CLI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-05-01T01:36:33.9666667+00:00

    Hi @ThunderBox

    Whether your application is an Asp.net 7 or Asp.net core 2 application? From the error message, it seems that your project having two different versions of the same assembly, to resolve this error, use the alias feature of the (References) compiler option or do not reference one of your assemblies.

    Then, clean and rebuild your application.

    More detail information, see Compiler Error CS0433.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Dillion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.