在哪里可以从包管理器窗口中执行的代码找到控制台或调试输出? [英] Where can I find the console or debug output from code executed in the package manager window?

查看:179
本文介绍了在哪里可以从包管理器窗口中执行的代码找到控制台或调试输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我首先使用EntityFramework代码进行迁移。从包管理器控制台,我正在运行update-database。这将执行我已经覆盖的Configuration.Seed(context)。

  protected override void Seed(WebContext context)
{

Console.WriteLine(Console Test);
Debug.WriteLine(Debug Test);
Trace.WriteLine(Trace Test);
}

在哪里可以找到该输出?



更好的是,如何输出回包管理器窗口?



Thx,
Dan

解决方案


在哪里可以找到该输出?


对不起,快速回答基本上没有。



至于在包管理器控制台中至少没有。

  Debug.WriteLine(Debug Test); 
Trace.WriteLine(Trace Test);

您可以看到 Debug ... Trace ... 方法,如果附加另一个Visual Studio来调试运行 update-database 命令。然后在debuggin VS中,您可以在输出窗口中看到输出。

  Console.WriteLine(Console Test); 

您可以看到控制台的输出... 方法,如果您运行与
migrate.exe 命令行工具与EF附带的迁移:




我如何输出回包管理器窗口?


我也有坏消息, 反射:通过当前实施的EF迁移,在执行 update-database (或任何其他命令)期间不支持显示自定义信息。


I'm using EntityFramework code first with migrations. From the package manager console, I'm running "update-database". This executes Configuration.Seed(context) which I have overridden.

    protected override void Seed(WebContext context)
    {

        Console.WriteLine("Console Test");
        Debug.WriteLine("Debug Test");
        Trace.WriteLine("Trace Test");
    }

Where can I find that output?

Better yet, How do I output back to the package manager window?

Thx, Dan

解决方案

Where can I find that output?

Sorry, but the quick answer is basically nowhere.

To be precise at least not in the package manager console.

Debug.WriteLine("Debug Test");
Trace.WriteLine("Trace Test");

You can see the output of the Debug... and Trace... methods if you attach another Visual Studio to debug the Visual Studio instance which is running the update-database command. Then in the debuggin VS you can see the output in the Output Window.

Console.WriteLine("Console Test");

You can see the output of the Console... methods if you run the migrations with the migrate.exe command line tool which comes with EF:

How do I output back to the package manager window?

I have here also bad news, after a quick "reflectoring": with the current implementation of the EF migrations it's not supported to display custom information during execution of the update-database (or any other command).

这篇关于在哪里可以从包管理器窗口中执行的代码找到控制台或调试输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆