After much research and trial and error here are the steps that I have found that works:
Environment:
- Windows 10
- Postgres 13
- ASP.NET Core 5
Steps to create:
- Create the Identity database on Postgress 13.
GRANT ALL ON DATABASE dbname TO user;
- Create an ASP.NET Core project targeting .NET 5 (net5.0) with Individual Authorization.
- Add the connection string to the
appsetting.json
file. - Add the
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
to the .csproj file. - If the package exits for using SqLite -- remove it.
- Rebuild Solution.
- In the Startup.cs, change
.UsingSqlServer
to,Npgsql
. - Save and rebuild.
- In the Developer PowerShell run:
dotnet-ef migrations remove
If there are no errors then run:dotnet-ef migrations add InitialIdent
If there are no errors run:- 'dotnet-ef' database update`
Now there should be the identity tables in your Postgres database.