用于迁移的dotnet cli在执行迁移期间不再显示输出消息。迁移已成功执行,但我不再在输出中得到执行结果
输出片段样本
verbose: Using assembly 'Model'.
verbose: Using startup assembly 'WebApi'.
verbose: Using application base '<my app path>\WebApi\bin\Debug\netcoreapp2.0'.
verbose: Using working directory '<my app path>\WebApi'.
verbose: Using root namespace 'Model'.
verbose: Using project directory '<my app path>\Model\'.
verbose: Finding DbContext classes...
verbose: Finding IDesignTimeDbContextFactory implementations...
verbose: Finding application service provider...
verbose: Finding IWebHost accessor...
verbose: Using environment 'Development'.
verbose: Using application service provider from IWebHost accessor on 'Program'.
verbose: Found DbContext 'ApplicationDbContext'.
verbose: Finding DbContext classes in the project...
verbose: Using context 'ApplicationDbContext'.
verbose: Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
verbose: Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
verbose: Finding design-time services referenced by assembly 'WebApi'.
verbose: No referenced design-time services were found.
verbose: Finding IDesignTimeServices implementations in assembly 'WebApi'...
verbose: No design-time services were found.
<it should show some output message such as 'No migrations were applied. The database is already up to date.' or the list of migrations that have been executed>
info: Done.
我正在使用以下CLI版本
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
我正在使用以下命令来运行迁移
dotnet ef database update -s ../WebApi --verbose --no-build -c ApplicationDbContext --prefix-output
更新 问题与Serilog有关。 通过添加以下Serilog配置,此问题已解决
“ Serilog”:{ “使用”:[ “ Serilog.Sinks.Debug” ], “最低级别”:{ “默认”:“详细”, “替代”:{ “ Microsoft”:“信息”,//显示ef迁移工具的输出 “系统”:“警告” } }, “写给”: [ {“ Name”:“ Console”} ] }