1. 程式人生 > >.net core 版 abp 部署

.net core 版 abp 部署

upa ima publickey 參數 ica 命令 location binder update

準備工作 進入abp官網 https://aspnetboilerplate.com/ 技術分享 創建你的項目 技術分享 本例,以創建.NET CORE 1.1版本為例 下載完畢後打開 一. VS2017打開項目,生成解決方案 二.打開程序包管理控制臺,默認項目選擇 src\Badmati.EntityFrameworkCore 2.1 運行如下命令 Add-migration InitialCreate 報錯 技術分享 Add-Migration : 無法將“Add-Migration”項識別為 cmdlet、函數、腳本文件或可運行程序的名稱。請檢查名稱的拼寫,如果包括路徑,請確保路徑正確,然後再試一次。 所在位置 行:1 字符: 1 + Add-Migration InitialCreate 原因是未引用entityframeworkcore, 2.2 運行如下命令,加載entityframework的引用 Import-Module C:\Users\{用戶名}\.nuget\packages\microsoft.entityframeworkcore.tools\1.1.1\tools\EntityFrameworkCore.psd1 例如: Import-Module C:\Users\Badmati\.nuget\packages\microsoft.entityframeworkcore.tools\1.1.1\tools\EntityFrameworkCore.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設置未啟動項,啟動項目 進入如下界面,配置成功: 技術分享 本次部署說明就寫到這裏,如果對你有幫助或這解決了你的問題,請點個贊。 如果沒有解決你的問題,歡迎留言討論。

.net core 版 abp 部署