Thursday, July 18, 2013

VSS to TFS Migration

Prerequisites
To complete this walkthrough, you need the following software installed on the computer where you plan to run VSSConverter.exe:
·         Team Explorer (By default, Team Explorer is installed during installation of Visual Studio 2010)
·         Log on to the computer by using administrative credentials
·         SQL Server Express (By default, SQL Server Express is installed during installation of Visual Studio)
·         Visual SourceSafe 2005 or later versions
·         The Visual SourceSafe database that you want to analyze. The database format must be version 6.0 or a later version. You must run the converter on the same computer as your Visual SourceSafe database to complete this walkthrough.
·         The administrator’s password for the Visual SourceSafe database that contains the projects that you want to analyze.
·         To perform this walkthrough, you must have administrative permissions for the Visual SourceSafe database that you will migrate. For more information, see How to: Assign Project Rights.
Analyzing the Projects
VSSConverter.exe is a command-line tool that requires the following input:
·         A path of the folder that contains the srcsafe.ini file for the Visual SourceSafe database under migration.
·         An XML-based file that contains settings.
·         VSSConverter.exe is stored in <root>:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE, but it can be invoked from the Visual Studio command prompt.
This walkthrough assumes that your Visual SourceSafe database is in c:\VSSDatabase.


In our case, we copied the vss database files to the machine where the prerequisites are installed. Although you can migrate a Visual SourceSafe database in a shared folder on a remote computer, the migration takes much longer to finish.
After you have decided which projects you want to analyze, create a file to contain the settings. This file lists the projects that you want the converter to analyze.

To create the settings file for analysis

1.       Open Command Prompt.
2.       At the command prompt, type mkdir c:\VSS2TeamFoundation, Press ENTER.
3.       At the command prompt, type cd c:\VSS2TeamFoundation. Press ENTER.
4.       Type notepad settings.xml, and then press ENTER.
5.       Select Yes to create the file.
6.       Copy the following XML.
<?xml version="1.0" encoding="utf-8"?>
<SourceControlConverter>
      <ConverterSpecificSetting>
            <Source name="VSS">
                  <VSSDatabase name="c:\VSSDatabase"></VSSDatabase>
            </Source>
            <ProjectMap>
                  <Project Source="$/ "></Project>
            </ProjectMap>
      </ConverterSpecificSetting>
      <Settings>
       <Output file="Analysis.xml"></Output>
     </Settings>
</SourceControlConverter>
7.       Save your changes and close Notepad.
Next, run the converter tool from the command prompt to analyze the project, as shown in the following steps.
The user who is performing the analysis must be a system administrator for SQLExpress. By default, the user who installs Visual Studio will receive the required permissions for SQLExpress.
After you have the migration settings file and granted system administrator rights, you can run the converter tool to analyze the project.

To analyze the project with the converter

1.       At the command prompt, type the following.
<root>:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE \VSSConverter Analyze settings.xml
2.       When you are prompted, provide the Visual SourceSafe administrator password.
The converter tool displays the status of the preconversion analysis. When it is completed, it generates a report (VSSAnalysisReport.xml) and a user mapping file (usermap.xml), and saves them in the current directory. You can use the user mapping file to map Visual SourceSafe users to Team Foundation users. For more information, see How to: Edit the Source Control Migration User Mapping File.

Migrating from Visual SourceSafe to Team Foundation:

Prerequisites
Before you try to complete this walkthrough:
·         Perform all steps as outlined in “Preparing to Migrate from Visual SourceSafe to Team Foundation.
·         Identify empty folders in Team Foundation version control where you want to migrate your Visual SourceSafe folders. If the destination folder does not exist, the converter will create it for you. The only exception is if the destination folder is a team project. The destination folder should be either a valid team project or a subfolder of a valid team project. For more information, see How to: Create a Team Project.
Additionally, you need:
·         A Team Foundation Server name.
In our case: server name: HOMECMP, Team Collection: PRJ-VSS, Team project: PRJ-VSS
·         You must have administrative permissions to connect to a SQLExpress database to use the converter tool.
Required Permissions
To perform this walkthrough, you must have administrative permissions for the Visual SourceSafe database that you will migrate. For more information, see "How to: Assign Project Rights" at the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=99103). You must also be a member of the sysadmin server role for SQL Express. By default, you are a member of the sysadmin server role if you are a member of the  Administratorssecurity group on the computer where SQL Express is installed. For more information, see "sysadmin" from the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=60405) in the SQL Server 2005 documentation.
Migrating SourceSafe Project Folders
Before you continue with the actual conversion, customize your settings file to include the destination folders for the SourceSafe projects that you specified when you prepare for conversion

To modify the settings file to create a migration file

1.       Open Command Prompt.
2.       At the command prompt, type cd c:\VSS2TeamFoundation. This folder was created when you analyzed the Visual SourceSafe database for migration.
3.       Save the settings file that you created for the analysis, settings.xml, with a new name, for example, migration_settings.xml.
4.       At the command prompt, type notepad migration_settings.xml, and then press Enter.
The settings.xml file you created when you analyzed your database for migration is displayed in Notepad.
5.       Change the settings file as follows.
·         In the <ProjectMap> section, for each Visual SourceSafe folder that you are migrating, add the destination folders in Team Foundation version control. Use the following format, adding the Destination section as shown in the following example.
·         <Project Source="$/FolderA" Destination="$/Team_Project"></Project>
To migrate everything in your Visual SourceSafe database, insert the following XML instead.
<Project Source="$/" Destination="$/Team_Project/"></Project> 
·         Under the <Settings> section, add a <TeamFoundationServer> section, and specify the name, port, and protocol for the Team Foundation Server to which you are migrating. Use the following format.
·         <TeamFoundationServer name="TFS_server_name" port="port_number" protocol="http" collection="collection_name" ></TeamFoundationServer>
For example,
<TeamFoundationServer name="AdventureWorks" port="8080" protocol="http" collection="tfs/DefaultCollection"></TeamFoundationServer>
6.       Remove <Output file="Analysis.xml"></Output> from the <Settings> section, or rename the output file to "migration_Analysis.xml".
Your migration_settings.xml file should resemble the following:
<?xml version="1.0" encoding="utf-8"?>
<SourceControlConverter>
      <ConverterSpecificSetting>
            <Source name="VSS">
                  <VSSDatabase name="c:\VSSDatabase"></VSSDatabase>
            </Source>
            <ProjectMap>
            <Project Source="$/" Destination="$/PRJ-VSS/"></Project>           
            </ProjectMap>
      </ConverterSpecificSetting>
      <Settings>
       <TeamFoundationServer name="HOMECMP" port="8080" protocol="http" collection="tfs/PRJ-VSS" ></TeamFoundationServer>
     </Settings>
</SourceControlConverter>
Be sure to substitute your server name for server name and an actual port number for port number.
7.       Save your changes and close Notepad.

To run the converter

1.       Open Command Prompt.
2.       At the command prompt, type the following.
<root>:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE \VSSConverter Migrate migration_settings.xml
3.       Type Y to confirm the migration.
When you are prompted, provide the password for the Visual SourceSafe admin user.
The converter tool displays the migration status. When the conversion process is finished, the tool saves a migration report in the current directory.

 

Incrementally Migrate to Team Foundation:

This topic describes how to do an incremental migration if you want to migrate your Visual SourceSafe database in phases.
Limitations on Incremental Migration
Be aware of the following limitations that apply when you start incremental migration and continue until all phases of incremental migration are finished.
·         You must not change the existing mapping of Visual SourceSafe folders to Team Foundation version control folders. Also you must not add or remove mappings.
·         Do not perform destroy, purge, archive, or restore activities on the Visual SourceSafe database.
·         Do not use the migrated Team Foundation version control folders.

To migrate in phases

Restart migration on the copied Visual SourceSafe database. The VSS converter will automatically determine that this is an incremental migration and start migrating changes that occurred after the first migration.
  1. Open Command Prompt.
  2. At the command prompt, type the following command, using the same settings file that you used during the previous migration:
<root>:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE \VSSConverter Migrate migration_settings.xml
  1. The converter automatically detects that this is an incremental migration, and it prompts you to confirm you want to do an incremental migration. Press Y to confirm that you want to do an incremental migration.

  1. When you are prompted, provide the password for the Visual SourceSafe admin user.
  2. The converter tool displays the migration status. When the conversion process finishes, the tool saves a post-migration report in the current directory.

VSSConverter automation
To automate the migration process we can create a batch file and add it to the windows task scheduler.
The batch file should resemble the following:
set SourceSCMPasswd=VssPassword
set HATCONTESTING=yes


"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\vssconverter.exe" migrate migration_settings.xml