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 on Ubuntu 20.04 using incorrect file paths

See original GitHub issue

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)

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
lonix1commented, Feb 2, 2021

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.

3reactions
deepchoudherycommented, Feb 11, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identity Scaffolding on Ubuntu 20.04 using incorrect file ...
I was having an issue with Omnisharp not being able to generate my razor pages. The link @vladimir provided, I found that running...
Read more >
Scaffold Identity in ASP.NET Core projects
This document explains the steps needed to complete an Identity scaffolding update. We recommend using a source control system that shows ...
Read more >
Newest 'asp.net-core-scaffolding' Questions - Stack Overflow
Identity Scaffolding on Ubuntu 20.04 using incorrect file paths dotnet 5. Output of dotnet --info: .NET SDK (reflecting any global.json): Version: 5.0.101 ...
Read more >
[Fix]-How do I include pictures into my Razor Page project?
Identity Scaffolding on Ubuntu 20.04 using incorrect file paths dotnet 5 · How to set appsettings.json automatically for deployment in ASP.NET Core?
Read more >
Change log : linux package : Ubuntu
Log in / Register · Ubuntu · linux package.
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