【发布时间】:2017-06-13 21:58:28
【问题描述】:
我正在开发一个全新的 .netcore api 项目。我正在尝试使用章鱼部署应用程序。
我需要从命令行执行迁移的帮助,但我没有得到很多帮助。如果有人可以帮助我,那真的很有帮助。
这是我迄今为止尝试过的: 我已经通过以下链接提出了解决方案,但它对我来说并不适用。
https://www.benday.com/2017/03/17/deploy-entity-framework-core-migrations-from-a-dll/
为了正确设置 dll 路径,我必须对脚本进行一些修改。 这是它现在的样子
set EfMigrationsNamespace=%Dummy.WebAPI
set EfMigrationsDllName=%Dummy.WebAPI.deps.dll
set EfMigrationsDllDepsJson=%Dummy.WebAPI.deps.json
set EfMigrationsStartupAssembly=%Dummy.Data.dll
set DllDir=%cd%
set PathToNuGetPackages=%USERPROFILE%\.nuget\packages
set PathToEfDll=%PathToNuGetPackages%\microsoft.entityframeworkcore.tools\1.1.1\tools\netcoreapp1.0\ef.dll
ECHO %PathToEfDll%
dotnet exec --depsfile .\%EfMigrationsDllDepsJson% --additionalprobingpath %PathToNuGetPackages% %PathToEfDll% database update --assembly .\%EfMigrationsDllName% --startup-assembly .\%EfMigrationsStartupAssembly% --project-dir . --content-root %DllDir% --data-dir %DllDir% --verbose --root-namespace %EfMigrationsNamespace%
但是脚本会抛出绑定错误的索引输出,这让我很困惑。这是一个例外。
System.IndexOutOfRangeException:索引超出了数组的范围。 在 Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.ParseOption(布尔 isLongOption,CommandLineApplication c 命令,String[] args,Int32& 索引,CommandOption& 选项) 在 Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) 在 Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) 索引超出了数组的范围。
这个错误有什么线索吗?或者我是否应该采取任何其他方法?
【问题讨论】:
标签: .net-core entity-framework-core octopus-deploy