0

I have a test application running on ASP.NET Core 3.2 Blazor.

I need to publish the site to a staging url for first stage testing. For this test I want to keep the application running on the same localdb files uses in development.

the connection string for the database locally is

Server=(localdb)\\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;MultipleActiveResultSets=true

The files for the database are stored currently in C:\Users\{username}\MyDatabase.mdf (along with the _log.ldf file).

How can I move this into the publish process with Visual Studio please? Do I need to relocate the file to the project directory and publish this way? Equally how do I then setup the server to know the database is stored in the project folder?

Matthew Flynn
  • 3,661
  • 7
  • 40
  • 98
  • You should keep your schema and data scripts in source control, and publish that to your staging environment instead of relying on binary files – ErikEJ Jun 07 '20 at 15:22
  • I currently have all the schema as code first migrations with entityframework. Normally I would have 2x connection strings which I would just switch based on the environment (after updating the db to match using the PMC). I'm just not sure how to handle this with passing a localdb to a server? – Matthew Flynn Jun 07 '20 at 16:06

0 Answers0