【问题标题】:ASP.NET Boilerplate template project build errorASP.NET Boilerplate 模板项目构建错误
【发布时间】:2018-09-12 09:56:26
【问题描述】:

我们在从https://aspnetboilerplate.com/Templates下载的启动模板项目中遇到构建错误

已下载的启动模板: ASP.NET Core 2.x 多页 Web 应用程序。

错误:

  1. 错误 CS0234:类型或命名空间名称“AspNetCore”不存在 在命名空间“Microsoft”中(您是否缺少程序集 参考?) - MyCoreProject.Core - LoginManager.cs

  2. 错误 CS0246:找不到类型或命名空间名称“Abp”(您是否缺少 using 指令或程序集引用?) - MyCoreProject.Core - LoginManager.cs

  3. 错误 CS0308:非泛型类型“PermissionChecker”不能与类型参数一起使用 - MyCoreProject.Core - PermissionChecker.cs

  4. 错误 CS1061:“类型”不包含“GetAssembly”的定义,并且没有扩展方法“GetAssembly”接受第一个 可以找到“类型”类型的参数(您是否缺少使用 指令还是程序集参考?) - MyCoreProject.Core - AppVersionHelper.cs

  5. 包 Microsoft.AspNetCore 2.0.1 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容。包 Microsoft.AspNetCore 2.0.1 支持:netstandard2.0 (.NETStandard,Version=v2.0)

  6. 包 Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.0.2 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容。包裹 Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.0.2 支持: netstandard2.0 (.NETStandard,Version=v2.0)

  7. 包 Microsoft.AspNetCore.Mvc 2.0.2 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容。包裹 Microsoft.AspNetCore.Mvc 2.0.2 支持:netstandard2.0 (.NETStandard,Version=v2.0)

  8. 一个或多个包与 .NETCoreApp 不兼容,Version=v2.0。

  9. 一个或多个包与 .NETCoreApp 不兼容,Version=v1.0。

  10. 包 Microsoft.AspNetCore.Authentication.Cookies 2.0.1 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容。包裹 Microsoft.AspNetCore.Authentication.Cookies 2.0.1 支持: netstandard2.0 (.NETStandard,Version=v2.0)

  11. Package Abp.ZeroCore.EntityFrameworkCore 3.5.0 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容。包裹 Abp.ZeroCore.EntityFrameworkCore 3.5.0 支持:netstandard2.0 (.NETStandard,Version=v2.0)

【问题讨论】:

  • 你的机器上有 EF Core 2 吗?
  • 你的 Visual Studio 版本是多少?
  • @R Sive,这个问题有什么更新吗?你解决了这个问题吗?如果没有,请告诉我有关此问题的最新信息吗?

标签: visual-studio asp.net-core nuget .net-standard aspnetboilerplate


【解决方案1】:
1) Install-Package EntityFramework
2) Add the below line in cs Projects
<ItemGroup>
    <Reference Include="netstandard" />
  </ItemGroup>
3) install netstandard from Nuget.
4)install this using package manager console 

Install-Package NETStandard.Library.NETFramework -Version 2.0.0-preview1-25305-02 -Pre
Install-Package NETStandard.Library.NETFramework -Version 2.0.0-preview2-25405-01 -Pre

5) Select the 'Web' project as the startup project.
6) Open the Package Manager Console, select the 'EntityFramework' project as the Default project and run EntityFramework's 'Update-Database' command. This will create the database. You can then change the connection string in the web.config.
7) Run the application. The default user name is 'admin' and the password is '123qwe'.

【讨论】:

    【解决方案2】:

    ASP.NET Boilerplate 模板项目构建错误

    创建并下载您的项目后,您仍需要按照以下步骤运行您的应用程序:

    • 在 Visual Studio 2017 v15.3.5+ 中打开您的解决方案并构建解决方案。

    • 选择“Web.Host”项目作为startup项目。

    • 检查 Web.Host - 项目的 appsettings.json 文件中的 连接字符串,如有需要可更改。
    • 打开 Package Manager Console 并运行 Update-Database 命令来创建您的数据库(确保选中默认项目 作为包管理器控制台窗口中的 .EntityFrameworkCore)。
    • 运行应用程序。如果成功,它将显示 swagger-ui

    注意:如果您在运行应用程序时遇到问题,请关闭并重新打开 Visual Studio。它有时会在第一次包还原时失败。

    在运行此应用之前,您还必须准备一些要求:

    • nodejs 6.9+ 和 npm 3.10+
    • 打字稿 2.0+

    然后恢复 npm 包:

    npm install
    

    更多详细信息,请查看Documents for Startup Template Angular

    【讨论】:

      【解决方案3】:

      我认为您的 Visual Studio 版本较旧,需要以下工具才能使用解决方案:

      1. Visual Studio 2017 v15.3.5+
      2. Visual Studio 扩展:Web 编译器和 Typescript 2.0+
      3. nodejs 6.9+ 和 npm 3.10+
      4. gulp(必须全局安装)
      5. 纱线
      6. SQL 服务器

      请参考PRE REQUIREMENTS 文档。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多