Share via


External Changes...

What happens when you make changes outside the scope of your project? What if you edit a file inside Notepad or sync your source code from your SCC system, either from the command line or from the VS IDE? Most users assume that the project automatically get updated as soon as the file is save on the local hard disk. 

Simple example

Lets look at a very simple example, where we make an external change to the project using Notepad.

  1. Create a new database project
  2. Add a table (by default Table1)
  3. Open a Command Prompt
  4. Open the dbo.Table1.table.sql script in Notepad
  5. Change the table definition, for example add column_3
  6. Save the script
  7. Now watch the Schema View tool window!

image 

 There are a couple of things to observe:

  1. The new column, "column_3" does not automatically show up in Schema View
  2. Instead a warning message/strip is displayed in the Schema View, stating "External file change, resynchronization required... "

If you click the "Synchronize" button and the message will disappear and when you expand the table node the added column is now present. 

 imageimage

Check out a this previous blog post on the difference between Synchronize and Refresh, https://blogs.msdn.com/gertd/archive/2007/02/18/to-synchronize-or-to-refresh.aspx.

 

What does this mean?

It means that when you make external changes to the project, these are not automatically reflected in the underlying model. You need to synchronize or (re)build the project to sync the state of the project. 

The most important time when you are exposed to this behavior is when you sync from source code control, since we do not get an event from the source code control system when the last file was synchronized, you need to synchronize or (re)build the project after you synched.

 

Visual Studio 2008

Because this behavior is not really discoverable we changed this in Visual Studio 2008. We added an option to automatically synchronize external file changes on idle. This option is exposed in Tools->Options->Database Tools->Design-time Validation Database: "Automatically synchronize files with the design-time validation database". This option is turned on by default.

image 

This new options changes the behavior in the following way. If you invalidate model by making an external change, the Schema View will still show the message strip that the underlying model is out-date. However after a while, based on the amount of changes that need to get propagated and if the system gets in to an idle state, the external changes will get picked up and the underlying model automatically will get updated. When the update has finished the message disappears.

Visual Studio 2005

So what about Visual Studio 2005 based implementations? Based on the user confusion caused by this behavior we are back porting this change to Visual Studio 2005 and we will make it available via a cumulative QFE which can be applied to v1.0 or v1.0+Service Release 1. Once the QFE is available I will post the KB article. Until then make sure when you are making external changes you underlying system is up-to-date.

-GertD

Comments

  • Anonymous
    October 17, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=9911

  • Anonymous
    November 21, 2007
    Now that Visual Studio 2008 is available, the question arises what has changed for Visual Studio Team

  • Anonymous
    November 21, 2007
    Now that Visual Studio 2008 is available, the question arises what has changed for Visual Studio Team