Can't check .mdf / .ldf in App_Data in TFS

I am working with ASP.NET C # MVC 5.

.mdf / .ldf files in App_Data do not show up in pending changes in command explorer. So I can't check them in TFS (visual studio online). I tried re-creating the project several times and none worked. What could be causing this?

+3


source to share


2 answers


Go to Team Explorer and find Excluded Changes and you should exclude it. Right click on the App_Data folder and enable it.

But you can revise including the database files. As development and testing progresses, every little interaction with the database causes a change, and most of it is trivial. Also, if anyone else is working on this project, they might not want your database file to overwrite them when they get the latest version.



If you are using Entity Framework Code-First, the database is automatically created when you build the project, which I believe, otherwise you just run the Update-Database command to do it. This allows each employee to have their own local database file to work with. You can also use migrations to create updates to the database structure. If you want the database to be generated with pre-populated data, you must use the Seed method.

+5


source


This is a common question. As "Ty Morrow" already answered in the comment above, there is an original Seed method in the Entity Framework that ensures that all values ​​are inserted. However, there are many scenarios where you also need to work with the last added / removed DB items not present in the seed method.

Please follow these steps to ensure that the data catalog file is included in the source control.

  • Click App_Data strong> and in the toolbar in environment click Show all files as below screenshot


See Bypass and click on ** Show all files **

  • Right click in the MDF (Data Source) file and select Include in project
  • Right click again in the MDF file and select Include in Source Control
  • Just Go to the file Right click in the root folder of the project directory and show the file under Source Control
0


source







All Articles