开发者

Visual Studio 2010 Macro to delete SQL files from a database project

开发者 https://www.devze.com 2023-01-12 03:14 出处:网络
I\'ve discovered that in Visual Studio 2010 Professional it is possible to refresh the database for a SQL Server Database Project (This feature is normally only available to the Premium and Ultimate v

I've discovered that in Visual Studio 2010 Professional it is possible to refresh the database for a SQL Server Database Project (This feature is normally only available to the Premium and Ultimate versions). All you need to do is delete all the SQL files from the "Schema Objects" folder (but leave the folder structure intact) and the "Database.sqlpermissions" file. Then the "Import Database Objects and Settings..." option will become enabled, allowing you to refresh the database project with the latest schema.

I would like to write a macro for Visual Studio 2010 that can do this.

The macro should...

  • Delete every .SQL file (or every file) in the "Schema Objects" folder and it's child folders, but do n开发者_JS百科ot delete the folders from the project. The files must be deleted AND removed from the project.
  • Delete the file "Properties\Database.sqlpermissions". The file must be deleted AND removed from the project.

Any tips on writing macros in Visual Studio will help me. Thanks.


You can refresh the model in the database project without deleting everything. Simply sync the model from the target database.

Right-click 'Schema comparisons', add a new schema compare (if you don't already have one). When you have created it, Double-click to run it. It will compare the source and target, and create a list of any differences. You can review and eliminate any chnages you do not want synchronising, then click 'Write Updates' to apply. [I don't have a Professional version installed to check if this is the same, but you would hope so!]


information on writing visual studio macros is located here...

http://msdn.microsoft.com/en-us/library/b4c73967(v=vs.80).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消