title: Publish Entity-Framework Code-First Migrations with no Context in the startup project
body: <p>I am building a solution with the following Projects:<BR></p>
  
  <ul>
  <li><code>Main.Data</code> - Class Library project</li>
  <li><code>Main.API</code> - Asp.NET MVC WebApi - references Main.Data</li>
  <li><code>Main</code> - Asp.NET MVC 4 web application - references Main.API</li>
  </ul>
  
  <p>I have a <code>MyContext : DbContext</code> class located inside <code>Main.Data</code> project.
  I have also successfully issues <code>enable-migrations</code>console command on <code>Main.Data</code> project, and I am successfully using LocalDB as an SQL server for my data and for <code>upgrade-database</code> migrations.</p>
  
  <p>The problem starts when I am trying to publish <code>Main</code> project to Windows Azure website.</p>
  
  <p>The Publish Profile that is automatically created using <code>Import from a Windows Azure web site</code> does not seems to recognize that I am using Entity Framework Code First solution, and so I can't enable <code>Execute Code First Migrations</code> as I would like to. <BR>Instead, I can only enable <code>Update database</code> scripts.</p>
  
  <p>I am using Visual Studio 2012 with Entity Framework 5.0.0 (Since the beginning of the project).</p>
  
  <p>Just to verify, I have tried to add a temporary <code>MyContext</code> class inside the <code>Main</code> Project and to <code>enable-migrations</code> on the <code>Main</code> project, and after that my Publish Profile automatically detected Entity Framework Code-First.<BR>
  That is, of-course, not a solution (or is it?)</p>
  
  <p>Here are some relevant threads:<BR></p>
  
  <ul>
  <li><a href="https://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/" rel="nofollow noreferrer">This</a> is the base learning tutorial.</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/dd394698#efcfmigrations" rel="nofollow noreferrer">This</a> explains deployment options, but no troubleshooting.</li>
  <li><a href="https://stackoverflow.com/questions/13230902/publishing-my-database-package-deploy-with-code-first-migrations/">This</a> actually gives a few ideas to try, but all seems unnatural.</li>
  </ul>
  
  <p>I am looking for a clean stable solution. Do I have to put my Context class inside the Main Project?</p>
  
  <p>Thanks in advance</p>