Visual Studio Scaffolding features fail more often than they succeed; and no meaningful error messages
See original GitHub issueDescribe the bug
I have found that the Add | New Scaffolder Item | Razor Pages using Entity Framework (CRUD) command fails more often that it succeeds. In fact, I’d say it fails initially close to 80% of the time. Sometimes I can resolve it, other times I cannot.
Please, Please PLEASE, can’t you give us some meaningful error messages here?!?
To Reproduce
In my current case, I’m accessing this command by right clicking the Pages folder under one of my Areas folders. I select my model and data context classes.
But when I click Add, it churns for a few moments and then I get an error.
Package restore failed is just not meaningful for me. What does it mean to restore a package here? And, more important, which package is failing? Without a meaningful error message, it sort of leaves me stuck.
Include the output of dotnet --info
.NET SDK (reflecting any global.json): Version: 5.0.301 Commit: ef17233f86
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.301\
Host (useful for support): Version: 5.0.7 Commit: 556582d964
.NET SDKs installed: 5.0.301 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version
16.10.3
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (5 by maintainers)
Top GitHub Comments
@upizs Thank you for your answer! I didn’t even read what --files means -_- In the end it required Microsoft.AspNetCore.Identity.UI to install. But besides that it worked. This is the final command: dotnet aspnet-codegenerator controller -name CustomerController -m Customer -dc ApplicationDbContext --relativeFolderPath Controllers --useDefaultLayout
It created controller and all CRUD views for it. It is enough. As for MSVS menu option I’ve reported to MSVS support: https://developercommunity.visualstudio.com/t/error-with-scaffolding-datamodel-for-aspnet/1515437 But I do not think that they will touch it in the near future.
I still facing the same problem when adding Identity
.NET SDK: Version: 8.0.100-preview.7.23376.3 Commit: daebeea8ea
Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\
.NET workloads installed: There are no installed workloads to display.
Host: Version: 8.0.0-preview.7.23375.6 Architecture: x64 Commit: 65b696cf5e RID: win-x64
.NET SDKs installed: 7.0.305 [C:\Program Files\dotnet\sdk] 8.0.100-preview.6.23330.14 [C:\Program Files\dotnet\sdk] 8.0.100-preview.7.23376.3 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-preview.6.23329.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-preview.7.23376.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download