Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Add new scaffolded item missing #290

Closed
rhegner opened this issue Nov 20, 2015 · 44 comments
Closed

Add new scaffolded item missing #290

rhegner opened this issue Nov 20, 2015 · 44 comments

Comments

@rhegner
Copy link

rhegner commented Nov 20, 2015

Im using Visual Studio 2015 with ASP.NET 5 RC1.

In the announcment (http://blogs.msdn.com/b/webdev/archive/2015/11/18/announcing-asp-net-5-release-candidate-1.aspx) it says that there should be a 'Add -> New Scaffolded Item' context menu, but it doesn't appear in my project.

@sayedihashimi
Copy link
Contributor

Hi @rhegner the scaffolding support is there but it's not feature complete yet. Scaffolding has some dependencies which are included in the Web + Individual Auth template. If the dependencies are not there then the menu item will not appear. In later releases we will update the support to edit project.json and other files to add the missing dependencies.

If you have an existing project which was created with the Empty template (or any template besides Web + Individual Auth) you may need to make some edits to enable the option.

@prafullbhosale @abpiskunov @balachir could you describe the requirements for the Add Scaffolded Item to be enabled?

@rhegner
Copy link
Author

rhegner commented Nov 20, 2015

Thanks for your response!
I started with the MVC + Individual Accounts template but I removed all EntityFramework related stuff since I'm implementing my own stores.
But I don't assume that scaffolding relies on EntityFramework, does it?

@sayedihashimi
Copy link
Contributor

@rhegner lets see what @prafullbhosale has to say about the dependencies.

@prafullbhosale
Copy link

Hi @rhegner, Scaffolding does indeed depend on EntityFramework.
The dependencies that you would need to enable the add scaffolded item are below:

EntityFramework.MicrosoftSqlServer
Microsoft.Extensions.CodeGenerators.Mvc
Microsoft.AspNet.Mvc.TagHelpers
Microsoft.AspNet.Mvc

@rhegner
Copy link
Author

rhegner commented Nov 20, 2015

Thanks for this clarification. However to me it is not immediately obvious why scaffolding should depend on EntityFramework.

In my opinion it would be desirable to be able to scaffold views and controllers based on arbitrary (non-EntityFramework) models.

@sayedihashimi
Copy link
Contributor

@rhegner this is just a point in time dependency. We will enable it w/o requiring EF in the next release hopefully.

@KimHojJ
Copy link

KimHojJ commented Dec 2, 2015

I have the same problem. I'm new to VS 2015 and I was following an example "Your First ASP.NET 5 Web App Using Visual Studio"
@prafullbhosale Where will I find the dependencies that I need to enable?

@piotrek-k
Copy link

@KimHojJ AFAIK you can add it using NuGet Packages (right-click on project - > manage NuGet Packages -> in search bar, type names of dependencies)

@prafullbhosale Unfortunately, after adding those dependencies (and restarting Visual Studio) the "New Scafollded Item..." [mentioned in tutorial in asp.net docs] still doesn't appear.

@Powerworks
Copy link

Adding the NuGet Packages mentioned by prafullbhosale enabled me to get the "Add Scaffold Item..." option.

The pre-release NugetPackages I used :

"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",

@wolf3d
Copy link

wolf3d commented Dec 24, 2015

@prafullbhosale I wish I had known this earlier. Added all dependencies and now I got options item for scaffolding functionality.

@RossAndrewMcLeod
Copy link

This functionality seems to have disappeared. It was working a couple of weeks ago for me and I started a new project and I can't get it to work now. There is no context option for "Add new scaffolded Item...". Here is my project.json below. Any thoughts or comments would be appreciated

{
"userSecretsId": "aspnet5-WebApplication1-#########",
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},

"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
},

"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},

"frameworks": {
"dnx451": { },
"dnxcore50": { }
},

"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
".user",
"
.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}

@seganaUK
Copy link

@RossAndrewMcLeod Did you ever find a solution for this?

Just installed VS Community 2015 + ASP.NET 5 RC1 and I do not see this option. I've made sure I have the required dependencies that every other post references, but no joy at all.

@auspex
Copy link

auspex commented Feb 2, 2016

I can't even find most of those dependencies.

"Microsoft.AspNet.Mvc": "6.0.0-rc1-final"

is installed, but

"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",

aren't even found by NuGet

@sayedihashimi
Copy link
Contributor

For those of you having issues, do you see the menu option if you use a project created from File->New Project and then select Web Application with Individual User Accounts auth setting?

@marengz
Copy link

marengz commented Feb 3, 2016

yes the issues still remain after using individual accounts Sayed. i have read this text which says scaffolding as been moved to command line, is this true, https://social.msdn.microsoft.com/Forums/vstudio/en-US/26298ce7-9491-48cb-8de0-10c8aa35f5ab/scaffolding-not-installed-on-visual-studio-2013-and-2015?forum=vssetup ?

@sayedihashimi
Copy link
Contributor

@marengz are you using Community edition of VS 2015? If not what version do you have installed.

@auspex
Copy link

auspex commented Feb 3, 2016

I ended up totally reinstalling VS 2015 (Community edition)... It's working now.

@marengz
Copy link

marengz commented Feb 3, 2016

VStudio 2015, i ended up reinstalling it twice, then the solution came with upgrading to ASP.NET 5 RC1, and adding the dependencies mentined above then its now working. phewwwww

@sayedihashimi
Copy link
Contributor

I'm still trying to reproduce this and still unsuccessful. One combo that I have not yet tried (because I'm having a hard time finding the installers) is having ASP.NET 5 RC1 + Azure SDK 2.8.1. If you are running into this and you have Azure SDK 2.8.1, try upgrading to the latest Azure SDK (2.8.2 at this time) and let me know if that fixes it.

@sayedihashimi
Copy link
Contributor

@marengz

yes the issues still remain after using individual accounts Sayed. i have read this text which says scaffolding as been moved to command line, is this true, https://social.msdn.microsoft.com/Forums/vstudio/en-US/26298ce7-9491-48cb-8de0-10c8aa35f5ab/scaffolding-not-installed-on-visual-studio-2013-and-2015?forum=vssetup ?

That is old info. See my update at dotnet/Scaffolding#135.

@timotahti
Copy link

I think that the ones still experiencing problems might have an invalid dependency: "Microsoft.Extensions.CodeGenerators.Mvc" used to be "Microsoft.Framework.CodeGenerators.Mvc" which won't work in RC1. So, check your dependencies and try using "Microsoft.Extensions.CodeGenerators.Mvc".

I obviously figured this out the hard way myself... :)

@2J
Copy link

2J commented Feb 10, 2016

@timotahti the dependencies don't seem to be the problem. Here are the dependencies of a new project that I made that doesn't have the context option:

    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"

@2J
Copy link

2J commented Feb 10, 2016

The issue fixed for me after updating ASP NET 5. Both are called Microsoft ASP.NET RC1 Update1, but version number went from 1.0.11125.0 -> 1.0.20204.0 (when seen from Control Panel -> Programs and Features)

image

@timotahti
Copy link

Hi, it seems I've lost MVC6 scaffolding (running rc1-final) for some reason. It's not available even if I create a new project using Individual User Accounts. Here's what I have installed (Help --> About Microsoft Visual Studio) - any ideas? The dependencies are OK and I have the latest ASP.NET RC1 (same version that 2J is using) + the latest Azure SDK (2.8.2.1) installed. Scaffolding used to work fine for me.

Microsoft Visual Studio Enterprise 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Enterprise

Architecture and Modeling Tools 00322-80000-00000-AA165
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015 00322-80000-00000-AA165
Microsoft Visual Basic 2015

Visual C# 2015 00322-80000-00000-AA165
Microsoft Visual C# 2015

Visual C++ 2015 00322-80000-00000-AA165
Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package 4.2.60128.3
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015 (RC1 Update 1) 14.1.20203.0
ASP.NET and Web Tools 2015 (RC1 Update 1)

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40204.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.2 14.0.20201.0
Azure App Service Tools v2.8.2

Common Azure Tools 1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

DataFactoryProject 1.0
Microsoft Data Factory Package

GitHub.VisualStudio 1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Microsoft Azure Data Factory Node Node 1.0
Azure Data Factory extension for Visual Studio Server Explorer.

Microsoft Azure HDInsight HQL Service 2.0.2900.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio 2.0.2900.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools 2.7
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.7.30818.1601

Microsoft Azure Tools 2.8
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.8.40211.2

NuGet Package Manager 3.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 14.0.50730.0
Microsoft SQL Server Data Tools

TypeScript 1.7.6.0
TypeScript for Microsoft Visual Studio

Xamarin 4.0.1.96 (dcea9c1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 6.0.1.10 (e98e962)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS 9.4.1.24 (47eb74b)
Visual Studio extension to enable development for Xamarin.iOS.

@timotahti
Copy link

Fixed my problem by repairing Visual Studio and ASP.NET RC1 installations, in this order.

@bravecobra
Copy link

I was using SQLite as my database provider for EF7
"EntityFramework.SQLite": "7.0.0-rc1-final",
thus instead of
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",

Adding the MicrosoftSqlServer nupkg again, made the menu item reappear. Glad I got it back. It got me stumped for a while, so I thought I'd mention it. It might help someone else out.

But still that raises the question why the scaffolding should be disabled when using another EF database provider. Scaffolding should be database agnostic. This should definitely be fixed, since not everybody is targeting SQL Server/Windows, specially the new Linux and Mac guys (like me).
Now I need to add a package for a database I'll never use, just to make my tooling work. Doesn't make sense!
And by the way, the default 00000000000000_CreateIdentitySchema.cs is also SQL server specific (having table annotation specifications). Again, that should be database agnostic as well.

@freerider7777
Copy link

Also missing in VS 2015 update 3. My project is updated from RC2 version...

@witoong623
Copy link

witoong623 commented Jul 17, 2016

Hello, I have the same problem, even new project, hope this information will help you reproduce this problem.
I updated from RC2 and tooling preview 1, at first I forgot to delete those old versions(both runtime and tooling), I just installed DotNetCore.1.0.0-VS2015Tools.Preview2, then went to the project and tried scaffolding, the scaffolding menu still there but it didn't work when I clicked create view, it told me something like existing tooling version(I think the new one, preview 2) didn't match the old one(preview 1)(sorry I didn't capture it).
After I realized that I didn't delete those old version, I deleted them, and I returned to VS, scaffolding menu is gone.

@garrettdavid1
Copy link

I had this same problem as well, but I was able to remedy it by comparing my project.json (Empty ASP.NET Core Web App without Auth) to the project.json generated when you create a full ASP.NET CORE Web App with Single User Auth. Make sure the files listed below are using the same versions:

"Microsoft.EntityFrameworkCore.SqlServer"
"Microsoft.EntityFrameworkCore.SqlServer.Design"
"Microsoft.EntityFrameworkCore.Tools"
"Microsoft.VisualStudio.Web.CodeGeneration.Tools"
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc"

The final dependency I updated was "Microsoft.VisualStudio.Web.CodeGeneration.Tools", so it's possible some of the others before it may not be essential. Nonetheless, this is what worked for me. I am now able to add scaffolded items. I hope this helps someone!

@leadanymind
Copy link

I was able to get it to show and work in a empty project by adding the following dependencies to my project. Hope this helps get people by with scaffolding for now until its baked into web projects.

 "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    }

@freerider7777
Copy link

@ddeamaral Thx, it works!
for .net core 1.1 I've added:
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc" : "1.1.0-preview4-final"

@newton3
Copy link

newton3 commented Jan 11, 2017

Sorry but this still doesn't work for me. The option shows up now but nothing happens when I click it. (using Visual Studio 2017 RC, so no project.json but .csproj).

@prafullbhosale
Copy link

@newton3 can you share you csproj file?

@newton3
Copy link

newton3 commented Jan 11, 2017

@newton3
Copy link

newton3 commented Jan 12, 2017

Please let me know if I am doing anything wrong here or if the functionality is not supported.

@prafullbhosale
Copy link

@newton3 these package references are no longer valid for MSBuild based projects.

https://gist.github.com/newton3/3a9f5a2105614177bd0d2620ec379691#file-project-csproj-L64-L69

Unfortunately for MSBuild based projects targeting 1.1 runtime, currently the scaffolding packages are not available publicly. (They will be available with the next VS 2017 RC release)

Below is how you would update the project in case you are targeting 1.0 runtime

Remove the highlighted package references from your csproj and add below to your project (add

    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild2-final" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild2-final" />

Note that Microsoft.VisualStudio.Web.CodeGeneration.Tools is a <DotNetCliToolReference> item in the project and not a PackageReference

Once the scaffolding packages supporting 1.1 projects using MSBuild are available, you would just need to update the version numbers in the above items

@newton3
Copy link

newton3 commented Jan 13, 2017

Ok.. Thanks! I hope adding packages from nuget as <DotNetCliToolReference> will also be fixed in next release, as I do not remember seeing any option to customize that. I simply installed the said package from nuget.

@prafullbhosale
Copy link

An update to this thread:
As of Visual Studio 2017 RC release (https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#jan27)
Add new scaffolded item is now available on non-individual auth web projects.

If the project doesn't have the necessary package references, Visual studio will launch a dependency scaffolder to install the necessary packages to the project (and optionally add some files to the project).
This will be a one time operation on the project after which scaffolding actions will be available as they were in the projects with individual-auth.

@sayedihashimi @mlorbetske

@DanJ210
Copy link

DanJ210 commented Mar 2, 2017

Hey all. Anyone know why I cannot install Entity Framework or even Microsoft.AspNet.Mvc? I can't install any of the above mentioned frameworks as I get this error message... NU1002 The Dependency Microsoft.AspNet.Mvc 5.2.3 does not support framework .NetCoreApp, Version=v1.0...

I've got all updates offered to me installed so I have no idea what the problem is. I then remove the dependencies that won't work and now my project is broken, so I have to transfer everything to a new project. Anyone know why I'm having this much of an issue and I cannot add these nuget packages?

@webtools-bot
Copy link

The GitHub Issue Tracker for the aspnet/Tooling repo is being deprecated in favor of Visual Studio's Report a Problem tool.

If this issue is still a problem with the RTW release of Visual Studio 2017, please report a new issue using the Report a Problem tool. While you can still use .NET Core and ASP.NET Preview tools with Visual Studio 2015, Visual Studio 2017 is now the officially supported tool for developing .NET Core and ASP.NET Core projects.

By using the Report a Problem tool (available in both VS 2017 and VS 2015), you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See Visual Studio's Talk to Us page for more details.

Please use the discussion topic here for feedback and questions on the deprecation of this issue tracker. Thanks!

@DanJ210
Copy link

DanJ210 commented Apr 17, 2017

This seems to no longer be an issue in VS2017 so that has been absolutely fantastically awesome!

@KevinKieran-zz
Copy link

KevinKieran-zz commented Sep 30, 2017

I am using Visual Studio Community for mac version 7.1.5 and I am experiencing this issue. Shouldn't this issue be fixed now?

@dviljoen
Copy link

dviljoen commented Feb 6, 2019

I'm having a similar problem in VS2017. I'm really stuck. I created a Core MVC project, which deployed and ran fine. I added Identity UI through Identity Scaffolding. It initially had an error when attempting to show the Login page (from the Identity UI scaffolding files). I found a workaround by adding MS.AspNetCore.Razor to the csproj. It apparently couldn't compile the scaffold pages at runtime without it. But the pages rendered with no style or codebehind-generated content.

That's when I noticed that the codebehind files were missing from the deploy. All of them were set to "Do Not Copy." I changed them to "Copy Always." But they are still not present. Am I to assume they were included in the compiled DLL? If I deploy to a folder then all of the files are there. How can I verify that they are in the compiled DLL?

BTW, I'm deploying to Azure.

@barrytang
Copy link

To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests