zoukankan      html  css  js  c++  java
  • .net core 版 abp 部署

    准备工作
    进入abp官网
    创建你的项目
     
    本例,以创建.NET CORE 1.1版本为例
    下载完毕后打开
     
    一. VS2017打开项目,生成解决方案
    二.打开程序包管理控制台,默认项目选择 srcBadmati.EntityFrameworkCore
    2.1 运行如下命令
    Add-migration InitialCreate
    报错
     
    Add-Migration : 无法将“Add-Migration”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
    所在位置 行:1 字符: 1
    + Add-Migration InitialCreate
     
    原因是未引用entityframeworkcore,
    2.2 运行如下命令,加载entityframework的引用
    Import-Module C:Users{用户名}.nugetpackagesmicrosoft.entityframeworkcore.tools1.1.1 oolsEntityFrameworkCore.psd1
     
    例如:
    Import-Module C:UsersBadmati.nugetpackagesmicrosoft.entityframeworkcore.tools1.1.1 oolsEntityFrameworkCore.psd1
    运行后出现如下警告(可以忽略):
     
     
     
    模块“EntityFrameworkCore”中的某些导入命令的名称包含未批准的动词,这些动词可能导致这些命令名不易被发现。若要查找具有未批准的动词的命令,请使用 Verbose 参数再次运行 Import-Module 命令。有关批准的动词列表,请键入 Get-Verb。
     
    2.3运行如下命令:
    Add-Migration InitialCreate
    报错如下:
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。
    File name: 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null'
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
    at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
    at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String contentRootPath, String dataDirectory, String rootNamespace, String environment)
    at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
    at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
    at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
    at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
    Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。
     
    2.4将EntityFrameworkCore设置为启动项目,再次运行
    Add-Migration InitialCreate
    结果如下:
    To undo this action, use Remove-Migration.
    表示运行成功
     
    2.5初始化数据库:
    Update-Database
    看到输出
    Done.
    表示执行完成
     
    2.6 将Web.Host设置未启动项,启动项目
    进入如下界面,配置成功:
     
    本次部署说明就写到这里,如果对你有帮助或这解决了你的问题,请点个赞。
    如果没有解决你的问题,欢迎留言讨论。
     
  • 相关阅读:
    Silverlight 自定义表格 转
    Application_BeginRequest事件过滤恶意提交
    存储过程学习1
    我是博客园新博客
    努力将SQL Server像玩游戏一样熟练
    【Demo 0003】支持交互的应用
    【Demo 0003】支持交互的应用
    linux终端快捷键
    vim与windows/linux之间的复制粘贴小结
    vimgrep简单使用
  • 原文地址:https://www.cnblogs.com/2langshen/p/7222078.html
Copyright © 2011-2022 走看看