question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identity Scaffolding to existing project is broken

See original GitHub issue

Describe the bug

Attempting to scaffold the Identity views into an existing .NET 5 project which references v5.0.5 of the Identity libraries does not work. The tool down-grades the NuGet package references, then complains that there are build errors because the site references a lower version of the packages than a referenced class library.

To Reproduce

Using Visual Studio 2019 v16.9.4, create a new solution with two projects:

  • A .NET 5.0 class library;
  • An ASP.NET 5.0 site;

In the class library, reference Microsoft.AspNetCore.Identity.EntityFrameworkCore version 5.0.5, and Microsoft.EntityFrameworkCore version 5.0.5. Create a class derived from IdentityContext.

In the site, reference the class library, and reference Microsoft.AspNetCore.Identity.UI version 5.0.5. Configure identity to use the context from the class library.

Verify that the solution builds without errors.

Right-click on the site and select “Add -> New Scaffolded Item”. Walk through the steps to scaffold the Identity views, as described in the documentation, selecting the correct context from the drop-down list.

After a while, the operation fails with an error:

image

The Identity and EF Core references in the site have been down-graded to version 5.0.4, and the site now fails to build because the class library references a higher version!

Further technical details

.NET SDK (reflecting any global.json): Version: 5.0.202 Commit: db7cc87d51

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.202\

Host (useful for support): Version: 5.0.5 Commit: 2f740adc14

Microsoft Visual Studio Professional 2019 Version 16.9.4 VisualStudio.16.Release/16.9.4+31205.134 Microsoft .NET Framework Version 4.8.04084 Installed Version: Professional

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
flicwincommented, Sep 21, 2021

Since 5.0.10 I’m unable to roll anything back because the first order of business when scaffolding Identity is to bring the corresponding packages up to date - which means every attempt to scaffold returns a rollback error. I have found an interim fix here which solved my issue. This article was written in February and people have been thanking the author all year. I hope it helps you too.

1reaction
flicwincommented, Aug 21, 2021

Created a new Blazor Net Core Hosted application with default IdentityServer & EntityFramework packages Version=“5.0.9” and received the same critical error during a scaffolding attempt overriding all. I changed the packages down to 5.0.8 and ran the scaffold again which this time completed successfully. Microsoft Visual Studio Community 2019 Preview Version 16.11.0 Preview 2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blazor Existing Project | Asp.net Identity scaffolding is not ...
I'm trying to scaffold asp.net identity in an existing project with the Login/Logoff pages already. The context is set up as well and...
Read more >
ASP.NET Core 6 Identity - Scaffolding Identity problem
I create ASP.NET Core Web App with individual user accounts and update a database. So far everything works. Then I scaffold the identity....
Read more >
ASP.NET core identity setup in blazor application
Right click on the Blazor web project and select Add - New Scaffolded Item... asp.net core identity scaffolding. Select Identity from both the...
Read more >
Challenges in Cybersecurity and Privacy - the European ...
This was in line with the project plan as improvement of both enrolment and ... If the authentication is broken by some means...
Read more >
HCI International 2021 - Late Breaking Posters: 23rd HCI ...
We think about a scaffolding structure anchor in blind facades or flat roofs of ... of neighborhood identity, hence an hypothetical social design...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found