# Debugging Entity Framework Seed methods

In Entity Framework projects, sometimes you need to debug your seed methods. This can seem a little tricky, since the code tends to run in the Package Manager Console;

And it’s a fire-and-forget kind of deal. Any runtime errors get swallowed. However, you can debug into your own EF code by;

1) Find the project that contains your DbContext and Configuration.cs file, and set it as your startup project.

2) Open the properties page for the project.

3) Set the external program to the EF migator exe. For EF 6.1, it’s at

(\$mySourceDirectory)\packages\EntityFramework.6.1.0\tools\migrate.exe

4) Set the command line arguments to point to the name of your EF assembly, the bin folder for that EF assembly, and the web.config or app.config which contains the connection string for the DB you’ll be updating, like so;

MyProject.EntityFramework.dll /startupConfigurationFile="..\..\..\MyWebsite\Web.config" /startupDirectory="full\path\to\MyProjectEntityFramework\bin\Debug"

5) Set breakpoints and press F5!