Scaffolding: Identity Scaffolding on Ubuntu 20.04 using incorrect file paths

Output of dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.302
 Commit:    41faccf259

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.302/

Host (useful for support):
  Version: 3.1.6
  Commit:  3acd9b0cd1

.NET Core SDKs installed:
  3.1.302 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

While following the Microsoft docs guide on scaffolding Identity, I was unable to scaffold Identity, presumably because the scaffolder is looking for files with the naming pattern Filename.cs.cshtml instead of Filename.cshtml.cs.

I initially tried scaffolding with a netcoreapp3.1 with Microsoft.VisualStudio.Web.CodeGeneration.Design 3.1.4, but when this failed I tried with netcoreapp3.0 and Microsoft.VisualStudio.Web.CodeGeneration.Design 3.0.0. Both runs were identical.

Steps to reproduce:

  1. Install the code generator: dotnet tool install -g dotnet-aspnet-codegenerator
  2. Create a project to scaffold into: dotnet new mvc -n IdentityApp -au Identity
  3. cd into the new project directory
  4. Install Microsoft.VisualStudio.Web.CodeGeneration.Design
  5. Install Microsoft.EntityFrameworkCore.SqlServer because scaffolding doesn’t seem to work without it
  6. Build the project to make sure everything works (build OK)
  7. Scaffold all Identity pages: dotnet aspnet-codegenerator identity -dc IdentityApp.Data.ApplicationDbContext

Expected behavior:

All Identity.UI Razor Pages are scaffolded into the project

Actual behavior:

A fatal error indicating a file was not found:

Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
A file matching the name Account.AccessDenied.cs.cshtml was not found within any of the folders: 
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:16.85

Additional information about the project being scaffolded, such as:

Target framework(s): netcoreapp3.1 and netcoreapp3.0

Package version of Microsoft.VisualStudio.Web.CodeGeneration.Design - this may be added to your project by scaffolding: 3.1.4 (netcoreapp3.1) and 3.0.0 (netcoreapp3.0)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Thanks that’s a decent workaround for now.


I guess the dotnet guys are all using windows else they’d have encountered this problem themselves. 😝

I hope it gets some attention soon, as scaffolding is totally broken in linux / net5. And it’s so useful.

@lonix1 @rolambert @KBastin @tedesco8 @christianspeegle I have a fix for this issue out with a new 3.1.5 and 5.0.2 package out. Use dotnet tool update dotnet-aspnet-codegenerator -g --version 3.1.5/5.0.2 depending on if you are targeting .netcoreapp3.1 or net5.0. I would like it if someone could confirm the fix before I close the issue.

Apologize for the lengthy delay on this fix and appreciate all the feedback.

There seems to be an issue with the .nuget cache folder ( /home/username/.nuget in Linux ) if it resides in a Case Sensitive filesystem (Linux and Mac). A way to temporarily avoid this problem seems to be mounting that folder in a Case Insensitive filesystem like it’s explained in a similar Issue: https://github.com/dotnet/Scaffolding/issues/1393#issuecomment-752041418

Until this issue is fixed, it is possible to downgrade net core sdk with the following commands: sudo apt-get remove dotnet-sdk-3.1 --purge sudo apt-get install dotnet-sdk-3.1=3.1.302-1 sudo apt-mark hold dotnet-sdk-3.1 dotnet tool uninstall -g dotnet-aspnet-codegenerator dotnet tool install -g dotnet-aspnet-codegenerator --version 3.1.3