Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have yet to find a solution that actually works without specifying the web/app.config file. See below. </p> <p>However, if you can accept providing a web/app.config and overriding the connection string as command-line parameters, then the following works with Entity Framework 5.0 nuget and .NET 4.5. Should also work for .NET 4.0 with the <a href="http://msdn.microsoft.com/en-us/data/jj618307.aspx" rel="noreferrer">documented workarounds</a>.</p> <p><strong>Example folder structure:</strong></p> <pre><code>trunk\MySolution.sln trunk\run_migration.bat trunk\MyMvc4App\MyMvc4App.csproj trunk\MyMvc4App\web.config trunk\MyMvc4App\bin\MyMvc4App.dll trunk\MyMvc4App\bin\EntityFramework.dll trunk\packages\EntityFramework.5.0.0\tools\migrate.exe </code></pre> <p><strong>run_migration.bat:</strong></p> <pre><code>SET AssemblyName=MyMvc4App SET StartUpDirectory=MyMvc4App\bin\ SET ConnectionString=Server=tcp:XXXX.database.windows.net,1433;Database=XXXX;User ID=XXXX;Password=XXXX;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True SET ConnectionStringProvider=System.Data.SqlClient SET ConfigFilePath=%CD%\MyMvc4App\web.config SET MigrateExe=packages\EntityFramework.5.0.0\tools\migrate.exe %MigrateExe% %AssemblyName%.dll /startUpDirectory:%StartUpDirectory% /startUpConfigurationFile:"%ConfigFilePath%" /connectionProviderName:"%ConnectionStringProvider%" /connectionString:"%ConnectionString%" /verbose pause </code></pre> <p>End of solution.</p> <hr> <p><strong>Omitting the configuration file:</strong></p> <p>If trying to omit the configuration file, I always got the following exception no matter what I tried. I didn't try EF 4.3, so I suspect the behavior changed between 4.3 and 5.0.</p> <pre><code>System.Data.Entity.Migrations.Design.ToolingException: Exception has been thrown by the target of an invocation. at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) at System.Data.Entity.Migrations.Console.Program.Run() at System.Data.Entity.Migrations.Console.Program.Main(String[] args) ERROR: Exception has been thrown by the target of an invocation. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload