Views/Shared/_Layout.cshtml not updated when scaffolding identity in 2.2 release
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Reproduce the identity scaffolding with the dotnet-aspnet-codegenerator identity command and inspect Views/Shared/_Layout.cshtml and Views/Shared/_LoginPartial.cshtml. Compare the generated layout with the reported workaround. Done means the generated layout references the login partial and the running app shows a working Login link.
Written by the indexing model from the issue text.
Description
Steps to reproduce:
Install release version of SDK 2.2 on Mac
dotnet --version
2.2.100
dotnet new mvc
Then init a git repo with suitable .gitignore and commit everything so we can easily see what was changed.
Add the scaffolded identity files:
dotnet tool update --global dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' was successfully updated from version '2.1.6' to version '2.2.0'.
Add this to csproj file as requested when attempting to run the generator:
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2" PrivateAssets="All" />
dotnet restore
Run the code generator:
dotnet-aspnet-codegenerator identity
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
RunTime 00:00:12.66
Run the app and notice there is no "Login" link in the nav bar.
Checking the contents of "Views/Shared/_Layout.cshtml" shows that the file "Views/Shared/_LoginPartial.cshtml" which was added by the code generator is not referenced and git shows no changes to the file.
Despite the lack of warning about updating existing file, run the generator again with the '--force' option:
Run the code generator with --force:
dotnet-aspnet-codegenerator identity --force
No difference.
Running:
dotnet-aspnet-codegenerator -h
shows there the force option is no longer there?
Expected behavior:
It should not generate broken scaffolding, the "Login" link should be there, it should work as it did previously in 2.1.
Actual behavior:
Code generator generates broken scaffolding for identity
Workaround:
This is easily be fixed by adding the partial to _Layout.cshtml, right after the navbar markup:
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
..............
</div>
<partial name="_LoginPartial" />
Seems there is also another issue with identity scaffolding, which i think also existed in 2.1
https://github.com/aspnet/Scaffolding/issues/884
- Dominant language
- C#
- Stars
- 818
- Forks
- 261
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/Scaffolding
-
area-dotnet-scaffolding area-identity bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/Scaffolding#3848 ·
-
area-dotnet-scaffolding area-identity bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
dotnet/Scaffolding#3846 ·
-
area-dotnet-scaffolding bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
dotnet/Scaffolding#3845 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
dotnet/Scaffolding#3828 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
dotnet/Scaffolding#3857 ·
All issues in dotnet/Scaffolding
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·