aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 123 forks source link

Attempting to scaffold a controller (with full dependencies) errors out #985

Closed davkean closed 7 years ago

davkean commented 7 years ago
  1. File -> New Empty ASP.NET Web App (.NET Core 1.1)
  2. Right-click on wwwroot, choose Add Controller
  3. Choose Full Dependencies
  4. Click Add...

-- Wait a long time --

Then eventually says:

---------------------------
Microsoft Visual Studio
---------------------------
Error

There was an error running the selected code generator:

'Package restore failed. Rolling back package changes for 'WebApplication1'.'
---------------------------
OK   
---------------------------
mlorbetske commented 7 years ago

cc @prafullbhosale

prafullbhosale commented 7 years ago

The wait for a long time is because we are calling the VS Nuget api to install packages, which does it one at a time. The package restore failure can be from multiple reasons, (restore timeout, configured sources don't have the necessary packages etc.)

I will add better error messaging to indicate why restore failed. Also, for the wait we need to show some output that indicates the actual action being taken, rather than just saying 'scaffolding...' all the way to completion.

warrenwrate commented 7 years ago

I was running into the same issue. The reason for my issue was due to the versions of my packages compared to the Target Framework that I was on... ".NetCoreApp1.0"

There were 1.1 version packages installed which were not compatible with my .NetCoreApp1.0 framework.

I hope this helps.

mlorbetske commented 7 years ago

I believe this has been fixed. If you're still running in to this, please file an issue on https://github.com/aspnet/scaffolding