架构比较和更新注释掉未使用的代码
我有一个 Visual Studio 2010 数据库项目。它对大多数东西都很有效。
然而有一件事非常烦人。假设我有一个名为 dbo.MyCoolTable 的表。如果我进入数据库并将其重命名为 dbo.MyKindaCoolTable 它在数据库中工作正常。
但是,当我进行架构比较并将更改写回我的数据库项目时,它将旧文件保留在项目中。所以我最终得到两个文件(dbo.MyCoolTable.Table.sql 和 dbo.MyKindaCoolTable.Table.sql)。
一次或两次这不是问题,但随着时间的推移,这确实会增加。浏览该项目并手动删除每个“遗留”文件是很乏味的。
当我从架构比较写入数据库项目时,有没有办法删除“剩余文件”?
I have a Visual Studio 2010 Database Project. It works great for most stuff.
However one thing is very annoying. Say I have a table called dbo.MyCoolTable. If I go the the database and rename it to dbo.MyKindaCoolTable it works fine in the database.
However, when I do a schema compare and write the changes back to my Database project it leaves the old file in the project. So I end up with two files (dbo.MyCoolTable.Table.sql and dbo.MyKindaCoolTable.Table.sql).
Once or twice this is not a problem, but over time this really adds up. And it is tedious to go through the project and manually delete each of these "left over" files.
Is there a way to just delete the "left over files" when I write to my Database Project from a Schema Compare?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,目前的情况并非如此,但 Denali 的一些更改有助于同步代码。然而,我还没有看到他们将这种范式带到了何种程度,也没有时间去尝试它。我知道这对当今世界没有帮助。
Not that I know of in the current world, but some of the the Denali changes help with syncing code. I have not seen how far they take this paradigm, or had time to play with it, however. I know that does not help in the current world.
我最近发现这也发生在我身上,所以我想找到所有已被注释掉的旧文件并将其删除。
脚本以“;”结尾并且我们想要删除的脚本被注释掉了,因此对项目中“;*/”的所有实例(不带引号)进行查找和替换可以很好地找到我们想要的脚本摆脱,那么只需从项目中手动删除有问题的文件即可。
我希望有一个更优雅的解决方案......
I recently found out this was happening to me too, so I wanted to find all the old files which have been commented out and delete them.
The scripts end with a ";" and the ones we want to get rid of are commented out, so doing a find and replace for all instances of ";*/" in the project (without the quotation marks) does a pretty good job of finding the scripts we want to get rid of, then it's just a matter of manually deleting the offending files from the project.
I wish there were a more elegant solution...