visual-studio-2015 - 缺少脚手架 ASP.Net Core

标签 visual-studio-2015 asp.net-core asp.net-core-mvc

传统上,Visual Studio 中曾经有脚手架来加速添加 Controller 、区域、 View 等。 在我安装 ASP.NET Core 后,我注意到所有这些都消失了,这太可怕了(尤其是当你想添加一个新的区域,手动完成这项工作会导致颈部疼痛)。

有什么办法可以把它们带回来吗?为什么微软团队会做出如此糟糕的决定?

enter image description here

最佳答案

Is there any possible way to bring them back?



您需要添加必要的包:
  • Microsoft.VisualStudio.Web.CodeGeneration.Tools
  • Microsoft.VisualStudio.Web.CodeGenerators.Mvc

  • 这是一个示例 project.json 文件:
    {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.1",
          "type": "platform"
        },
        "Microsoft.AspNetCore.Mvc": "1.0.1",
        "Microsoft.AspNetCore.Hosting": "1.0.0",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0",
        "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"
        }
      },
      "tools": {
        "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
          "version": "1.0.0-preview2-final",
          "imports": [
            "portable-net45+win8"
          ]
        }
      },
      "frameworks": {
        "netcoreapp1.0": {
          "imports": [
            "dotnet5.6",
            "portable-net45+win8"
          ]
        }
      }
    }
    

    添加这些包后,您将可以访问脚手架。

    enter image description here

    作为引用,上面的屏幕截图来自 Visual Studio 2015 Update 3,具有以下相关扩展:
  • Microsoft .NET Core 工具
  • Microsoft ASP.NET 和 Web 工具
  • Microsoft ASP.NET Web 框架和工具
  • 关于visual-studio-2015 - 缺少脚手架 ASP.Net Core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39938246/

    相关文章:

    c++ - 无法与标准库链接

    c# - 为什么 MySQL 数据库中的 Code First 没有创建模型 connectionString?

    asp.net - HttpContext 不包含 SignOutAsync 的定义

    c# - 计算 XML 节点脚本任务 SSIS

    c# - 在asp.net核心中,空字符串是否转换为NULL?

    asp.net-core - EF 7 迁移。不同程序集中的 Web 项目、DBContext 和迁移

    c# - 为什么这个 ASP.NET Core POST 请求返回 "405 (Method Not Allowed)"?

    Angular 7. NullInjectorError : No provider for HttpClient! 即使 app.module 有 HttpClientModule。如何解决?

    c# - 使用单个 View 模型在 MVC Razor View 上发布多个表单

    c# - VS2015 在添加新的实体数据模型时抛出异常