There are no scaffolders supported for this item Visual Studio 2019
Asked Answered
O

9

29

I'm using Visual Studio 2019 version 16.0.4, and I tried to create a view or a partial one on asp.net core 2.1 (in views folder) but I get an error

There are no scaffolders supported for this item

Then I realized this problem happens when you have a folder which its name is "Pages" in your project that we use this folder for razor pages .

If I remove the pages folder then the views scaffold works. When I put it back it is broken again.

I don't know it is a bug or not but I need to use both pages and views together on my project...

Osterman answered 19/5, 2019 at 6:41 Comment(1)
The pages folder was doing it (still a bug over 6 months later in 16.4.3) - pretty bad as a default .net core mvc web app has this pages folder in and has broken scaffolding.Hutto
O
0

I checked it couple weeks ago and it seems solved by the updates i guess.

Osterman answered 12/8, 2020 at 12:13 Comment(1)
which update? I still have the same error in 2022Dishwasher
S
17

Update 31/7/2019

I was mistaken (24th Update), see comments on this post, it's apparently still broken, either way, the original answer below still works, in both cases.

Update 24/7/2019

The answer below still stands if your using an older release of Visual Studio 2019, however please be aware this has now been fixed in the more up-to date releases:

https://developercommunity.visualstudio.com/content/problem/562039/there-are-no-scaffolders-supported-for-this-item-1.html


Original Answer

There's currently a known bug in Visual Studio 2019 for this scenario.

There is some semi official advice on the GitHub issue tracker, but it doesn't always work.

MS Will fix it eventually, there appears to currently be no timescale.

For now however, if you right click and use add new item:

enter image description here

Then pick the item type you want (In my case it's a razor page)

enter image description here

Then you'll find everything still works as expected. The bug only seems to affect the shortcut menus.

Sparkman answered 20/5, 2019 at 16:36 Comment(13)
THX. your solution is fine. it works … but how about adding a view with a Model Class and a template ? as I was concerned we could create a view with a Model class only with shortcut menusOsterman
Not entirely sure about that. If you select Razor Page, you do get a code behind model created with it, but I don't use "Views" (I'm assuming you mean MVC by the way) so I can only assume that picking the right template will give you the correct files. Some item templates do create multiple files, so there's no reason to suspect that there's not an appropriate one available. If you can't find one then try selecting "Online" and searching in there, there may be a new one available for download.Sparkman
Still broken (16.3.0 Preview 1.0)Puttyroot
Kewl tks, I thought it was fixed when the GH req I originally looked at appeared closed. I've lost the main GH issue link I had.Sparkman
Rapidly approaching 4 months later and still broken. Are we a joke to you, MS?Chichihaerh
iv'e given up even checking it... partially since I've lost the original link I had bookmarked :-)Sparkman
still broken? :(Buttery
As far as I know Enrico, yes. Although that said, I can't find the Github ticket for it anymore, it seems to have vanished so I honestly couldn't tell you. :(Sparkman
Still broken on VS2019 Version 16.5.0 Preview 4.0...but this answer still works!Ledge
Yup, unfortunately so, but yes... that's why I left this answer in place without marking it as answered.Sparkman
I checked it couple weeks ago and it seems solved by the updates i guessOsterman
@MortezaNejat great stuff. Can you remind me of the URL to the issue again, it's been that long since I looked, I don't remember where it is. If it has been fixed, I'll happily update things and mark this as accepted/fixed etc.Sparkman
Just got this error on v17.9.1Commander
V
15

I see this problem in my visual studio when I add "Pages" Folder to my ASP.NET MVC core project. before I adding this folder, scaffolding works fine, and when I add this, I see the error. Also when I remove "Pages" folder, scaffolding work fine again. ;)

Voucher answered 17/11, 2019 at 21:49 Comment(2)
This worked for me... Just check "Pages" folder content before deleting it. Mine was empty and right after deleting it Scaffolding worked again.Newborn
In my case, this was the source of the problem too. I had Pages folder in my project and scaffolding was not working. After deleting the Pages folder everyting was fine. But as jpmir said, just make sure that there is nothing in the Pages fodler before deleting.Chickenhearted
C
1

None of the above fixed my issue, so I thought I'd leave feedback as well. Updating .NET versions fixes this for me. I was on 4.5 and moved up to 4.5.2. To test this, I created a sibling project of the same type (.NET MVC Web) with 4.5.2, and tried to create scaffolding items again, and it works.

I will either use the new project to house my scaffolding items, or try to upgrade my original project to 4.5.2. I'm sure any version over 4.5.2 would work as well, but I'm using an older one due to server architecture.

UPDATE: It would appear that updating the version is not what solved the issue. So it was the act of adding a new project that works... I'm not sure why though. I will update this again if I find out.

Carmarthenshire answered 27/4, 2020 at 15:28 Comment(1)
(Note that above (&below) refer to an order of presentation that is not fixed. (I don't have a solution but for using the tedious preexisting.))Knorring
A
1

Getting this error on VS Community 2022 v17.0.2 Project ASP.NET Core Web App MVC (6.0)

When using option add Controller. error

Works fine when using add new item and then choosing the specific file.

Axletree answered 5/2, 2022 at 11:50 Comment(0)
B
0

I solved it by downgrade Microsoft.VisualStudio.Web.CodeGeneration.Design on version 2.2.4 from 3.x. from Nuget packages for my solution. I hope it helps some one.

Bacchus answered 8/1, 2020 at 10:18 Comment(0)
W
0

I Created a folder named Views and Error never shows again

Workshop answered 24/4, 2020 at 19:38 Comment(0)
O
0

I checked it couple weeks ago and it seems solved by the updates i guess.

Osterman answered 12/8, 2020 at 12:13 Comment(1)
which update? I still have the same error in 2022Dishwasher
D
0

I don't know if it is my same problem but its very similar...

My solution was update NuGet.Frameworks

*My problem: For example, I created a method called AnyName, next I did double click and add new View
Image1

So, next I simply did click in add new Razor View Image2

Next start the Scaffolding to create the new View: Image3

But it cant create the view and send the follow error: there was an error running the selected code generator package restore failed (there was an error running the selected code generator package restore failed)

Im Using: VSCommunity 2019 v16.7.2*

Dryfoos answered 28/8, 2020 at 18:45 Comment(0)
E
0

This is a really rare situation but If you accidentally created an F# project instead of C#, that will cause the issue. It will somehow append to the C# solution for some reason, excluding it and creating new C# app with Microsoft.VisualStudio.Web.CodeGeneration.Design version 3.1.5 (net5.0) will fix the issue.

Exserviceman answered 31/5, 2022 at 18:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.