aspnetcore: Scaffolding command in official documentation is broken (on Linux, at least)
Describe the bug
The following scaffold command from this page in the official documentation is broken:
dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.RegisterConfirmation"
To Reproduce
Here are the exact commands that reliably reproduce the bug on my system, including my attempts to fix it (installing requested packages) and the exact error messages:
[david@blue c#-projects]$ cd /tmp
[david@blue /tmp]$ dotnet new webapp --auth Individual -o WebApp1
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/3.1-third-party-notices for details.
Processing post-creation actions...
Running 'dotnet restore' on WebApp1/WebApp1.csproj...
Restore completed in 102.71 ms for /tmp/WebApp1/WebApp1.csproj.
Restore succeeded.
[david@blue /tmp]$ cd WebApp1
[david@blue WebApp1]$ dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.RegisterConfirmation"
Building project ...
Scaffolding failed.
Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
To see more information, enable tracing by setting environment variable 'codegen_trace' = 1.
RunTime 00:00:04.36
[david@blue WebApp1]$ dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
Writing /tmp/tmpuDeUwH.tmp
info : Adding PackageReference for package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' into project '/tmp/WebApp1/WebApp1.csproj'.
info : Restoring packages for /tmp/WebApp1/WebApp1.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json
info : OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json 19ms
info : Package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' is compatible with all the specified frameworks in project '/tmp/WebApp1/WebApp1.csproj'.
info : PackageReference for package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' version '3.1.4' added to file '/tmp/WebApp1/WebApp1.csproj'.
info : Committing restore...
info : Generating MSBuild file /tmp/WebApp1/obj/WebApp1.csproj.nuget.g.props.
info : Writing assets file to disk. Path: /tmp/WebApp1/obj/project.assets.json
log : Restore completed in 515.17 ms for /tmp/WebApp1/WebApp1.csproj.
[david@blue WebApp1]$ dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.RegisterConfirmation"
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
Please install the following packages to your project for scaffolding identity: Microsoft.EntityFrameworkCore.SqlServer
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:04.68
[david@blue WebApp1]$ dotnet add package Microsoft.EntityFrameworkCore.SqlServer
Writing /tmp/tmpbouOSr.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore.SqlServer' into project '/tmp/WebApp1/WebApp1.csproj'.
info : Restoring packages for /tmp/WebApp1/WebApp1.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json
info : OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json 153ms
info : Package 'Microsoft.EntityFrameworkCore.SqlServer' is compatible with all the specified frameworks in project '/tmp/WebApp1/WebApp1.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore.SqlServer' version '3.1.8' added to file '/tmp/WebApp1/WebApp1.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /tmp/WebApp1/obj/project.assets.json
log : Restore completed in 420.98 ms for /tmp/WebApp1/WebApp1.csproj.
[david@blue WebApp1]$ dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.RegisterConfirmation"
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
A file matching the name Account.Register.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:05.93
[david@blue WebApp1]$
Exceptions (if any)
See previous section
Further technical details
ASP.NET Core version is in dotnet info. The issue takes place when using solely the dotnet command with no IDE.
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.108
Commit: c423b556b5
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/3.1.108/
Host (useful for support):
Version: 3.1.8
Commit: 05a0c8f6b1
.NET Core SDKs installed:
3.1.108 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 21 (15 by maintainers)
While waiting for this to be fixed, is there some place that I can download a fully scaffolded project to learn how to have accounts in my asp.net core apps? I’m about to be forced into a different backend framework, as a framework that I can’t do authentication in is useless to me, but I really don’t want to give up EFCore.
@deepchoudhery - Can you please prioritize this issue. Looks like the scaffolding is broken in non-windows environments.