Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add-Migration Value cannot be null. Parameter name: language

I am trying to create a new migration but I get an System.ArgumentNullException saying:

System.ArgumentNullException: Value cannot be null.
Parameter name: language
    at Microsoft.EntityFrameworkCore.Utilities.Check.NotNull[T](T value, 
    String parameterName)
    at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor
    (IOperationReporter reporter, Assembly assembly, Assembly 
    startupAssembly, String projectDir, String rootNamespace, String 
    language)
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ct
    or>b__4()
    at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Value cannot be null.
Parameter name: language
like image 820
Bug Avatar asked Mar 07 '18 09:03

Bug


People also ask

Why add migration is not working?

add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

How do I add migrations to EF?

Open the Package Manager Console from Tools → Library Package Manager → Package Manager Console and then run the enable-migrations command (make sure that the default project is the project where your context class is).


1 Answers

This is issue #11075. The version of your tool doesn't match the version of your runtime. Ensure you've updated every Microsoft.EntityFrameworkCore package to 2.1.0-preview1-final.

like image 188
bricelam Avatar answered Sep 18 '22 15:09

bricelam