Take the 2-minute tour ×

When i run migrations to create a database via the Package Manager Console. Is there a way to output text from the Seed method to the NuGet console?

Just the simple create command:

Update-Database -StartupProjectName "Data" -Verbose
share|improve this question

3 Answers 3

I don't think you can output it directly, but you can use tracing and debug commands and attach another instance of VS to see the output.

Taken from this question: Where can I find the console or debug output from code executed in the package manager window?

share|improve this answer

The command

Update-Database -Verbose

print in your console the sql code for the migration, but another way is:

Update-Database -Script

that open another file in Visual Studio with the sql code.

Thats is the only ways for get the sql code of migration. You can not to get the sql code of migration in debug because the migration run like power shell, and because it don't run the project.


You can not go to into the migration or debbug it because the migration run like a power shell command.

You can to get the Entity Framework>Migration source code in entityframework.codeplex.com

share|improve this answer
This would return the SQL code, but not output what happens inside the seed method –  amhed Feb 19 '13 at 21:55
@Amhed I talk about it: you can not to debug because it is in power shell, do you can not to go to into the method. You can to read the method if you get the source code of the Entity Framework, because the migrations run like power shell and is in another project, not in inside Entity Framework –  MayogaX Feb 19 '13 at 23:24

You can execute an SQL PRINT command within the Up() or Down() methods of each individual migration.

base.Sql("PRINT 'I heart kittens';");

This will output 'I heart kittens' to the Package Manager Console window in highlighted yellow text during the 'update-database' process.

share|improve this answer

Your Answer


