Migration to/from not found while creating migration script with ASP.NET Core tools
<p>I am trying to use the command <code>dotnet ef migrations script</code> in order to create an SQL script for between the last applied migration and the last not applied migration. Applied migration is one for which is called <code>dotnet ef database update</code></p>

<p>I try to execute the following commands and none of them works:</p>

<pre><code>dotnet ef  --startup-project ../DbMigrations/ migrations script from LastAppliedMigration to LastNotAppliedMigration -o temp.sql --context MyProject.DbModel.MusicDbContext

dotnet ef  --startup-project ../DbMigrations/ migrations script from LastAppliedMigration -o temp.sql --context MyProject.DbModel.MusicDbContext
</code></pre>

<p>I get the following error: <strong>System.InvalidOperationException: The migration 'from' was not found.</strong></p>

<pre><code>System.InvalidOperationException: The migration 'from' was not found.
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsAssemblyExtensions.GetMigrationId(IMigrationsAssembly assembly, String nameOrId)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateScript(String fromMigration, String toMigration, Boolean idempotent)
   at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.ScriptMigration(String fromMigration, String toMigration, Boolean idempotent, String contextType)
   at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsScriptCommand.Execute(CommonOptions commonOptions, String from, String to, String output, Boolean idempotent, String context, String environment)
   at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsScriptCommand.&lt;&gt;c__DisplayClass0_0.&lt;Configure&gt;b__0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
</code></pre>

<p>For migration names I tried both versions with the prefix timestamp and without:</p>

<ol>
<li>20160920085915_LastAppliedMigration</li>
<li>LastAppliedMigration </li>
</ol>

<p>Do I use this command <code>dotnet ef migrations script</code> correctly?</p>

<p><strong>Edit 1</strong></p>

<p>I did a simple example to demonstrate the issue which I have. The example can be downloaded from here <a href="https://1drv.ms/u/s!AkypHMylcA0XiYt-5xaPY7dJaMMkPQ" rel="nofollow">Download example</a></p>

<p>What I did:</p>

<ol>
<li>Created a default web application project</li>
<li><code>dotnet ef migrations add Initial</code></li>
<li><code>dotnet ef migrations script -o initial.sql</code> -- the initial.sql file was created</li>
<li><code>dotnet ef database update</code> </li>
<li>Added <code>Student</code> class in <code>Data</code></li>
<li>Added ``DbSet<code>in</code>ApplicationDbContext```</li>
<li><code>dotnet ef migrations add Student</code></li>
<li><code>dotnet ef migrations script from 20160924174811_Initial -o student.sql</code></li>
</ol>

<p>Here I get the following error -- The migration 'from' was not found.</p>

<pre><code>Project WebApplication3 (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.              
System.InvalidOperationException: The migration 'from' was not found.                                          
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsAssemblyExtensions.GetMigrationId(IMigrationsAssembly assembly, String nameOrId)                                                                                     
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateScript(String fromMigration, String to Migration, Boolean idempotent)                                                                                 
   at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.ScriptMigration(String fromMigration, String to Migration, Boolean idempotent, String contextType)                                                             
   at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsScriptCommand.Execute(CommonOptions commonOptions, String from, String to, String output, Boolean idempotent, String context, String environment)                     
   at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsScriptCommand.&lt;&gt;c__DisplayClass0_0.&lt;Configure&gt;b__0()   
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)                      
   at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)                                      
The migration 'from' was not found.
</code></pre>

<p>When I do <code>dotnet ef migrations list</code> I get the following result:</p>

<pre><code>Project WebApplication3 (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
20160924174811_Initial
20160924175511_Student
</code></pre>

<p>The version of the CLI tools is </p>

<pre><code>dotnet --version
1.0.0-preview2-003131
</code></pre>