Make an initial migration of the VB6 source code
1. Open the VBUC
2. Create a Migration Solution for your code (for example C:\MergeExample\Sample1)
3. Upgrade your code
4. Open the Explorer and navigate to the location of your VB6 code (For example C:\MergeExample\Sample1)
5. Under the directory where your code is located, create a new directory called GreenCode (For our example this directory will be C:\MergeExample\Sample1\GreenCode )
6. Copy your migrated code to GreenCode (for our example it means copying the contents of C:\MergeExample\Sample1\VB6_UpgradedCode to the C:\MergeExample\Sample1\GreenCode).
All this is important to helps us stablish a base line for comparison and merge
7. Open Microsoft Visual Studio 2005
8. On the Team Explorer locate your project (for example MergeExample) and double click on SourceControl
9. On the Source Control Explorer toolbar click the Add Files button
10. Click the Add Folder… button and select the GreenCode folder we had just created
11. Check in the GreenCode. IMPORTANT. Add a descriptive Comment. We recommed at least setting this information:
Green Code Date VB6 Source Code Date/ version VBUC version used to generate the Green Code
12. Create a brach of the Green Code
Create a Branch of the GreenCode directory and call it MigratedCode.
For example in the target field type: $/MergeExample/Sample1/MigratedCode
After branching you will node a MigratedCode folder under Sample1 in the Source Control Explorer
>Performing Manual Changes in your migrated code
Now you are ready to perform manual changes in your branch.
Check out for Edit the MigratedCode folder
Modify code
Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click
MessageBox.Show("Command1 was clicked", Application.ProductName)
End Sub
For
Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click
//mrojas simple change for message box
MessageBox.Show("Command1 was clicked", Application.ProductName,MessageBoxButtons.YesNo)
End Sub
Check In of your changes
Changing the VB6 Source Code
If you have changes in your VB6 source code and you want to feed those changes to the ongoing migration, follow these steps.
1. Check out the VB6 source code
2. Overwrite your all sources with the new VB6 source code, or your modify the current version.
For these example we will modify the current version, by adding a new button
and adding some comments to our previous code. So now the VB6 code will be:
Private Sub Command1_Click()
'This is a sample comment for command1 code
MsgBox "Command1 was clicked"
End Sub
Private Sub Command2_Click()
'This is a sample comment for command1 code
MsgBox "Command2 was clicked"
End Sub
Private Sub Command3_Click()
MsgBox "The newly added Command3 was clicked"
End Sub
And after the changes we check in it back.
Adding a new comment to identify this version
Performing the Continuous Migration Process
1. Check out the green code
2. Open the VBUC and migrated again the VB6 Code. In our example the code is in C:\MergeExample\Sample1\VB6
3. Copy the new contents of the Upgraded folder and overwrite the contents of folder GreenCode (in this case copy contents from C:\MergeExample\Sample1\VB6_UpgradedCode\Upgraded to C:\MergeExample\Sample1\GreenCode).
4. Check in the Green Code
Add a descriptive comment like:
Green Code 22-09-2009 12:34pm
VB6 Source Code 22-09-2009 12:00pm / version 2
VBUC version 3.0
Now merge with current manual changes
After migrating the modified VB6 source code and checked in it in the Source Control we now have to merge the changes between the new GreenCode and our MigratedCode.
1. Right click on the GreenCode folder and select merge. Put attention to chech that you want to merge the “Selected ChangeSets” and that the target branch is the MigratedCode
Click Next
2. Select the Change sets that you will apply. The comment you use provide a guide to identify which changeset you need.
Click Next
3. Click Finish to perform the Merge
4. During merge conflict might arrise. A resolve conflicts dialog will appear. Clicking the resolve conflicts button will provide different options…
5. In our example we know that we modified the Form1.vb file so we select the “Merge changes in merge tool” option
TIP: Typically you will just keep changes in target branch because you have already worked on those files. Specially for resource files, project files, bitmaps, etc you will leave the file in the target branch.
6. The merge tool will appear showing the different changes and providing you a simple way to select what version to take or to manually edit the result
7. When you are done with the Merge tool click close a dialog indicating that all conflicts have been solved will appear. Click Yes
8. Click close in the Resolve Conflict dialog and if asked to accept the merge result click yes
The Source Control Explorer might show marks in the modified files.
9. Right click on the migrated code and select check in changes
10. Type an appropiate comment indicating which versions where merged and press Check In
And that’s all