1

How can I share a single MDF between two projects in Visual Studio efficiently?

I know I can install it to the local db store, but I prefer to keep the MDF as part of a test package for sharing to the other devs until we get past initial greenfield on this solution.

I've got a Windows Service that is doing some polling of data, and I need to put that data into the database (currently at App_Data\support.mdf) and I need to read that data from an MVC app (also a project in the solution) for display purposes.

How can I share the database between the two, or in some way circumvent creating the database locally? I realize the extremely short answer to this is "create a local database and move on" but I have to believe there's some other answer.

current connection string:

Data Source=(LocalDB)\v11.0;Initial Catalog=Support;AttachDbFilename=|DataDirectory|\Support.mdf;Integrated Security=True

current app structure:

Solution
  Project1-WindowsService
    App_Data
      Support.mdf
  Project2-MVCApp
    App_Data
      Support.mdf
  Project3-CommonResources
  Project4-WindowsServiceMigrations
    YayFluentMigrator
  Project5-MVCAppMigrations
    YayFluentMigrator
  Project6-CommonResourcesAgainEtc
jcolebrand
  • 15,889
  • 12
  • 75
  • 121
  • Possible duplicate of [How to share a LocalDB instance across all projects in a solution?](http://stackoverflow.com/questions/15960535/how-to-share-a-localdb-instance-across-all-projects-in-a-solution) – Anton Kalcik Feb 26 '16 at 16:09

0 Answers0