Visual Studio 2015数据库(.mdf)版本控制 [英] Visual Studio 2015 database(.mdf) versioning

查看:161
本文介绍了Visual Studio 2015数据库(.mdf)版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在用C#开发一个使用Visual Studio 2015的项目,但是我无法使用内置的Git Source Control进行提交。我做了一些研究,发现我不应该尝试提交.mdf文件,而是创建一个脚本,以便数据库自动创建。不幸的是我无法在任何地方找到此选项。现在我能做什么?

解决方案

使用Visual Studio数据库项目。

<在Visual Studio中,您可以简单地连接到数据库,右键单击它并说创建新项目。这将允许您将数据库导入到数据库项目中。数据库项目基本上是所有数据库对象的一堆SQL脚本。您可以将该项目添加到源代码管理中。之后,通过修改数据库项目中的项目来更改数据库。您可以像对待其他VS项目一样对源代码进行这些更改。即使您在VS之外更改了数据库,例如使用Management Studio,仍然可以将项目与数据库同步,并将检测到的更改提交到源代码管理。


I'm currently developing a project in C# using Visual Studio 2015 with a database but I can't get it to commit with built-in Git Source Control. I did some research and found out that I shouldn't try to commit .mdf files but make a script so the database creates automatically. Unfortunately I can't find this option anywhere. What can I do now?

解决方案

Use Visual Studio Database project.

In Visual Studio you can simply connect to your database, right click on it and say "Create New Project". That will allow you to import your database into Database Project. Database project is basically a bunch of SQL scripts for all your database objects. You can add that project into source control. After that you make changes to your database by modifying items in your database projects. You commit these changes to source control the same way you would do with any other VS project. Even if you made changes to your database outside VS, using Management Studio, for example, you can still sync your project with the database and commit detected changes to source control.

这篇关于Visual Studio 2015数据库(.mdf)版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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