无法将 App_Data 中的 .mdf/.ldf 签入 TFS [英] Can't check in .mdf/.ldf in App_Data into TFS

查看:17
本文介绍了无法将 App_Data 中的 .mdf/.ldf 签入 TFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ASP.NET C# MVC 5.

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

.mdf/.ldf 文件不会出现在团队资源管理器中的 Pending Changes 中.因此我无法将它们签入 TFS(在线视觉工作室).我试过几次重新创建该项目,但都没有奏效.这可能是什么原因?

.mdf/.ldf files in App_Data do not appear on Pending Changes in team explorer. Therefore I can't check them into TFS(visual studio online). I've tried recreating the project a few times and none worked. What might be the cause for this?

推荐答案

转到 Team Explorer 并找到 Excluded Changes,您应该会发现它已被排除.右键单击 App_Data 文件夹并包含它.

Go to Team Explorer and locate Excluded Changes and you should find it excluded. Right click the App_Data folder and include it.

但您可能需要重新考虑包含数据库文件.在您进行开发和测试时,每一个小的数据库交互都会触发一个更改,其中大部分都是微不足道的.此外,如果其他人正在处理此项目,他们可能不希望您的数据库文件在获取最新版本时覆盖他们的数据库文件.

But you might want to reconsider including the database files. As you're developing and testing, every little database interaction will trigger a change and most of those are trivial. Also, if someone else is working on this project, they may not want your database file to overwrite theirs when they Get Latest Version.

如果你使用Entity Framework Code-First,我相信在你构建项目时会自动生成数据库,否则你只需运行Update-Database 命令即可.这让协作的每个人都可以使用自己的本地数据库文件.您还可以利用迁移来更新数据库结构.如果您希望使用预先填充的数据生成数据库,则应使用 Seed 方法.

If you're using Entity Framework Code-First, the database is automatically generated when you build the project I believe, otherwise you just run the Update-Database command to do it. This lets everyone collaborating have their own local database file to work with. You can also utilize migrations to make updates to the database structure. If you want the database to be generated with pre-populated data, you should utilize the Seed method.

这篇关于无法将 App_Data 中的 .mdf/.ldf 签入 TFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆