How to set the right AttachDbFilename relative path in ASP.NET Core?

前端 未结 2 1649
臣服心动
臣服心动 2020-12-06 07:22

Working in VS2015 on a web project based on ASP.NET Core (former ASP.NET 5), .NET Core CLR RC1, EF Core (former EF 7), EF Migrations enabled, LocalDb v11.0.

I manual

2条回答
  •  忘掉有多难
    2020-12-06 08:02

    I found an easier way around

    1. run your app and create the DB in the default location

    2. Open Microsoft Sql Server Management Studio (or you prefer IDE) and create a new connection to point to (localdb)\mssqllocaldb

    3. Script Database as CREATE

    4. Change the path in the FILENAME

    5. Remove the DB you created on step 1 (choose close existing connections)

    6. Run the script

    Your application should work without changing anything in the config

提交回复
热议问题