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

时间:2018-04-03 06:48:53

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

我们在从https://aspnetboilerplate.com/Templates

下载的启动模板项目中遇到了构建错误

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

错误:

  
      
  1. 错误CS0234:类型或命名空间名称' AspNetCore'不存在   在名称空间' Microsoft' (你错过了一个集会吗?   参考?) - MyCoreProject.Core - LoginManager.cs

  2.   
  3. 错误CS0246:类型或命名空间名称' Abp'找不到(你错过了使用指令或汇编引用吗?) -   MyCoreProject.Core - LoginManager.cs

  4.   
  5. 错误CS0308:非泛型类型' PermissionChecker'不能与类型参数一起使用 - MyCoreProject.Core - PermissionChecker.cs

  6.   
  7. 错误CS1061:'输入'不包含' GetAssembly'的定义没有扩展方法' GetAssembly'接受第一个   类型'类型'可以找到(你错过了使用   指令或程序集引用?) - MyCoreProject.Core -   AppVersionHelper.cs

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

  10.   
  11. 包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)

  12.   
  13. 包Microsoft.AspNetCore.Mvc 2.0.2与netcoreapp2.0(.NETCoreApp,Version = v2.0)不兼容。包   Microsoft.AspNetCore.Mvc 2.0.2支持:netstandard2.0   (.NETStandard,版本= 2.0)

  14.   
  15. 一个或多个软件包与.NETCoreApp,Version = v2.0不兼容。

  16.   
  17. 一个或多个软件包与.NETCoreApp,Version = v1.0不兼容。

  18.   
  19. 包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)

  20.   
  21. 包Abp.ZeroCore.EntityFrameworkCore 3.5.0与netcoreapp2.0(.NETCoreApp,Version = v2.0)不兼容。包   Abp.ZeroCore.EntityFrameworkCore 3.5.0支持:netstandard2.0   (.NETStandard,版本= 2.0)

  22.   

  

3 个答案:

答案 0 :(得分:1)

我认为你有一个旧版本的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. SQL Server
  6. 请参阅PRE REQUIREMENTS文档。

答案 1 :(得分:0)

  

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

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

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

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

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

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

在运行此应用程序之前,您还需要准备一些要求:

  • nodejs 6.9+,npm 3.10 +
  • Typescript 2.0 +

然后恢复npm包:

npm install

有关详细信息,请查看Documents for Startup Template Angular

答案 2 :(得分:0)

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'.