We have been trying to run EF Core Migration in .Net Standard 1.6 class library, but it has been failing. But same passes very well in .Net Core 1.1 class library.
For you EF Core Package Manager Console Tools users who are seeing the following errors:
Startup project 'MyNetStandardLibrary' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the Entity Framework Core Package Manager Console Tools with this project, add an executable project targeting .NET Framework or .NET Core that references this project, and set it as the startup project; or, update this project to cross-target .NET Framework or .NET Core.
OR
Your target project 'MyNetCoreApp' doesn't match your migrations assembly 'MyNetStandardLibrary'. Either change your target project or change your migrations assembly.
The documentation reveals the cause of these errors:
The target project is where any files are added (or in some cases removed). The target project defaults to the Default project selected in Package Manager Console, but can also be specified using the -Project parameter.
The startup project is the one emulated by the tools when executing your project's code. It defaults to one Set as StartUp Project in Solution Explorer. It can also be specified using the -StartupProject parameter.
In a nutshell, you need to set your StartUp Project to a project that has a .NET runtime (.NET Core in this case), then make sure you set your .NET Standard project as the Package Manager Console > Default Project.
Example CLI Solution:
Add-Migration MyMigration -Project MyNetStandardLibrary -StartupProject MyNetCoreApp
Non-CLI Solution: