views:

84

answers:

2

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 not 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.

A: 

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!]

Mitch Wheat
Not with Visual Studio 2010 Professional, only with higher versions. I would love to be wrong, but I don't see any options in my version.
Carter
A: 

I guess nobody knows how to write Visual Studio macros. Disappointing.

Carter