How To: Deploy VSS Project Files Selectively

A reader emailed me this request for more infomation yesterday, “We keep several types of web projects in VSS, some apps from VStudio, some from dreamweaver, etc. As it stands now, both the shadow folder and deploy contain *all* the files. I'd like to be able to specify which files are (or are not) deployed.”

The current SourceSafe documentation does not address this common scenario very well. Argh.  I'll correct this as soon as I finish writing this blog post. The fix should be available in the next release of Visual SourceSafe.  If you're a seasoned VSS user who works with SS commands routinely and you have the attention span of a crack addict, here's the one line answer: SS GET $/projectname *.ext1 *.ext2 file?.* -GLc:\deploypath -Yusername (Italics == variables). For those of you who haven't been locked in a room with VSS and a box of donuts since 1996 and want to understand why and how this works (or even, what the heck it is), here's the full story.

You can “deploy“ the files in a VSS project to a physical location on your computer or another one on your network in three ways:

  • Set up a Shadow Folder for the database or for a specific VSS project folder (for more information about shadow folders, see related blog post #1 and blog post #2).

  • Designate a VSS project as a Web Project and then use the Deploy command.

  • Use the SS Get command-line command (Note: SS Checkout, which involves a Get operation, works as well).

As the reader who emailed this question points out, options 1 and 2 don't support per-file deployment. You can shadow a VSS project folder but you can't shadow an individual file.  You can Deploy the files in a VSS project folder to a path on disk but you can't use wildcards to specify exactly which files you want.

Option 3, SS Get, is the silver bullet.  You can use the SS Get command to retrieve an individual file to disk, recursively retrieve the contents of a VSS project or database to disk, or you can retrieve files with a certain extension or name pattern using wil*cards. The following procedure assumes that you have not configured your machine for turnkey execution of SourceSafe command-line commands.

  1. In Windows Environment Variables (My Computer|Properties|Advanced|Environment Variables) add variable SSDIR and set its value to the path of your database; the folder in which your srcsafe.ini file resides.

  2. Add a new environment variable PATH and set its value to the path to your \Win32 folder (e.g., %PATH%;c:\Program Files\Microsoft Visual Studio\vss\win32)

  3. Add a new environment variable SSUSER and set its value to your normal username (eg, RWagner).

  4. In Windows Explorer, browse to and open the \Users\your_username\ss.ini file in a text editor from your SourceSafe database directory.

  5. Add a new line: Force_Dir = Yes, and save your changes. (Note: this step is not mandatory for this particular operation but I strongly urge you to do this. For details, see Force_Dir, Get to Current Folder or Working Folder?.)

  6. Open a command shell and type: 
    SS GET $/projectname *.ext1 *.ext2  file?.* -GLc:\deploypath -Yusername
    where the variables ext1 and ext 2 are file extensions such as .asp, .aspx, .htm, etc, where file?.* is a filename that matches a certain pattern, and where username is your VSS login ID. Note: the first character of your file name cannot be ‘?’.
    The -GL switch allows you to override the default working folder and specify exactly where you want to place the files. If you completed step 5 and deploypath is the same as your working folder, the -GL switch is optional. If you completed step 3, the -Y switch is optional.

Result: Only files with the specified extensions and pattern-matching file names are "deployed" (aka, gotten) to the deploypath from your project.

Comments (11)

  1. Nisha Gora says:

    I’ve got a question relating to this area and i’m hoping someone out there can help. We’ve been trying to utilise the labelling functionality within VSS. When we do a release we’ve been labelling individual files within a project. When we go to deploy that release I’ve been attempting to pull out only those files given a particular label (e.g. 5.0.3) but unfortunately this functionality doesn’t appear to work very well. Does anyone have any ideas on how I can pull out all files with a given label?

  2. Bill Wake says:

    >Does anyone have any ideas on how I can pull out all files with a given label?

    I’m having the same problems. I’m trying variations on

    SS GET -VLlabel $/foo

    (with various "" marks around the label, of "$/foo;L label" etc.)

  3. boverton says:

    Option 3 seems to work fine for the top level project folder, but as soon as I add a -R to the command line it seems to ignore the file types listed and pulls every file type. Any suggestions?

  4. How to get letest file using .Bat file.

  5. Ben Shichman says:

    Im stuck!  

    Have been trying to use the deploy command similar to above.

    ss deploy "-VL Ver1" $/project

    When it attempts to deploy, it DOES create the directories at the destination correctly, but the files are NOT deployed and the command line yields the follow error:

    Version not found

    However, if I do the same SS statement about with the History option, it works fine to display the files.  What am I doing wrong??

    Thank you !

  6. Thanks!!!”> auto site insurance. [URL=]home insurance[/URL]: The autos insurance company, compare car insurance, auto insurance. Also [url=]cars insurance[/url] from website .

  7. Hi! auto site insurance. The autos insurance company, compare car insurance, auto insurance. from website .

Skip to main content