ef core don´t use ASPNETCORE_ENVIRONMENT during update-database

后端 未结 4 753
情话喂你
情话喂你 2020-12-04 17:40

I use visual studio to update all my environments with a certain migration. It had worked fine using the command below.

update-database -Migration initMigrat         


        
4条回答
  •  时光取名叫无心
    2020-12-04 18:16

    To set the ASPNETCORE_ENVIRONMENT variable in Package Manager Console (PMC) , inside visual studio, to Production use this command first

    $env:ASPNETCORE_ENVIRONMENT='Production'
    

    Then you can use

    Update-Database
    

    normally.

提交回复
热议问题