Home > Back-end >  Error: Value cannot be null. (Parameter 'connectionString') Migrations secrets.json
Error: Value cannot be null. (Parameter 'connectionString') Migrations secrets.json

Time:10-11

When running the command: "dotnet ef migrations add init -o" it gives an error for not finding the database connection string. I'm using the file "secrets.json" and the connection string is correctly configured in it, but it's not finding it.

enter image description here

Now open your project in file edit mode and look for the "UserSecretsId" tag. Confirm that the value of this key has exactly the same name as the folder where the "secrets.json" file is

You will also find more information here: https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows

  • Related