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.

Visual Studio Scaffolding features fail more often than they succeed; and no meaningful error messages

See original GitHub issue

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

Untitled

But when I click Add, it churns for a few moments and then I get an error.

Untitled

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:closed
  • Created 2 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ZiColdcommented, Sep 3, 2021

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

0reactions
nguyentuananh921commented, Aug 11, 2023

I still facing the same problem when adding Identity image

.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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Resolve Scaffolding Issue in ASP.NET Core ...
I 'm getting the following error when I try to scaffold the Login, Logout, and Register pages. ScaffoldingError. I ran the Visual Studio...
Read more >
Scaffolding fails creating a view in Microsoft ...
1 web app I get the attached message saying scaffolding failed. fixed in: visual studio 2019 version 16.9Visual Studiowindows 10.0visual studio ...
Read more >
Problem with scaffolding in VisualStudio 2019 ASP.Net ...
I have tried putting all other packages to 5.0.2, that did nothing. This is the error message I get. ErrorMessage. My Installed packages....
Read more >
How To Fix Common Errors Using ASP.NET MVC Scaffolding
A feature called Scaffolding creates a Controller and several Views on basis of a model. How does this feature work and how can...
Read more >
Fix Update: Scaffolding failed, could not load information for ...
In this video, I going to fix this error, Scaffolding failed in visual studio dring adding razor view, area etc. so you can...
Read more >

github_iconTop Related Medium Post

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