A SourceSafe shadow folder is a UNC share* in which VSS maintains a current copy of the latest database version of every file in a SourceSafe project and all of its subprojects. When you or a teammate check in changes to a source-controlled file whose project has a shadow folder, its shadow copy is--or should be--overwritten on disk.

A shadow folder can get out of sync with the SourceSafe database for a number of reasons. The most common are:

  1. A new project is added to a shadowed project (RESULT: new subproject is not shadowed on disk)
  2. An existing subproject is renamed, shared, moved, or deleted (RESULT: changes are not reflected on disk)

To confirm that a SourceSafe shadow folder is up to date

1.      In VSS Explorer, select the shadowed project.

2.      Click Tools and then click Show Differences.

3.      In the Show Differences dialog box, enter the UNC path of the project’s shadow folder in the To: box (usually, this involves overwriting the path to your working folder), and then click OK.

If there are any differences between your database version and its shadow copy, they are highlighted. 

You can restore synchronicity between the database version of a project and its shadow copy using any of the following techniques:

  1. Quickest Update Method -- In the Project Difference viewer, click the Reconcile All button, which sits a couple of buttons left of the handy dandy '?'.
    Disclaimer -- in some situations, like the one outlined in http://support.microsoft.com/default.aspx?scid=kb;en-us;162113, this may not work.
  2. Easy, Trusted Update Method -- Reestablish the shadow folder path in VSS Administrator in the Options dialog box (Tools|Options|Shadow Folders).
  3. Complex, Trusted Update Method -- (I'm flying by the seat of my pants here so feel free to correct any errors...) Add a new user to the database called Admin_Shadow. Login to VSS Explorer as the Admin_Shadow user, select the SourceSafe project whose shadow folder you wish to synchronize with its latest database version, click SourceSafe and then click Get Latest Version. When prompted to set a working folder, click OK.
    In the Set Working Folder dialog box, enter the UNC path to the project's working folder in the Name box, and then click OK. The latest database version of the project, its subprojects, and files therein are then automatically gotten to Admin_Shadow's working folder, which is also your shadow folder.

Some software development teams use a (read/write) Shadow Folder to share their latest bits with each other, usually for local builds.  For the very reason that many types of everyday changes can break the synchronicity between Shadow Folders and SourceSafe projects, I do not recommend this method.  However, the SourceSafe help says, "To make sure that every user has the most recent version of files, it may be desirable for all users to compile source code out of a centralized folder, instead of in personal working folders. In this case, shadow folders are frequently used in conjunction with the Remove local copy after Add or Check In option on the Local Files tab in the Options dialog box on the Tools menu." Microsoft documentation is almost always right ;-).  As an alternative to this iffy method, you might consider writing a script that routinely (or OnBlank event) gets the latest version of a project/subproject to the working folder of an administrative user (you can even call it Admin_Shadow) and then removes the read-only protection for all contained files, if necessary for build purposes.

What are your experiences with Shadow Folders? Have you encountered synchronization issues? If so, how did you work around them? Have you resorted to something like the 'Complex, Trusted Update Method' mentioned above?  If so, how did it work for you?  Inquiring minds want to know.

Related Post: http://blogs.gotdotnet.com/korbyp/commentview.aspx/f65c0513-f128-4d04-8858-28765a7b714a.


*typically and preferably, although you can specify any physical path. Don't use mapped drives though.


Il presente posting viene fornito “così come é”, senza garanzie, e non conferisce alcun diritto.