asp.net core 2.0 - Value cannot be null. Parameter name: connectionString

后端 未结 22 1914
时光取名叫无心
时光取名叫无心 2020-12-13 10:00

I had the following error in package manager console when Add-Migration

Value cannot be null. Parameter name: connectionString

22条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 10:28

    Probably, the issue is with your DotNetCliToolReference from the csproj file. If you migrate the project from an older version of asp.net core, the DotNetCliToolReference is not automatically updated. Update the yourproject.csproj file to use the 2.0.0 version of the CLI as shown in the snippet bellow:

    
    
            ...
              
    
    

    Rerun, from the project folder, the dotnet command with -v switch to see results

    dotnet ef database update -v
    

    Also, recheck your Microsoft.EntityFrameworkCore nuget packages to reference the 2.0.0 version. Remove or update older EF packages. The minimum are:

    • Microsoft.EntityFrameworkCore.SqlServer

    • Microsoft.EntityFrameworkCore.Design

    both 2.0.0 at this moment.

提交回复
热议问题