Build Visual Basic 6.0 Applications with Visual Studio Team Services

While giving a webinar on DevOps with Visual Studio Team Services, I was asked if you could build VB6 applications. My response was simple. Visual Studio Team Services can be used to build any language, targeting any platform.  That is true but I wanted to prove it. So in this post I will show you how to build a VB6 application using Visual Studio Team Services. The information here should help you build any language, targeting any platform, with Visual Studio Team Services.

The first thing you will have to do is create a private agent.  Visual Studio Team Services provides hosted build agents running in Azure.  However, VB6 is not installed on those machines.  Therefore, to build VB6 applications you are going to have to create a machine that has VB6 and the Visual Studio Team Services build agent on it.  Whenever I create a build machine I start with a Azure VM using the latest Visual Studio Community template. As of this writing, that was Visual Studio Community 2015 Update 2 with Universal Windows Tools and Azure SDK 2.9 on Windows Server 2012 R2.

Once the machine is provisioned and running in Azure RDP to the machine so we can start installing VB6 and the build agent.  Installing VB6 on Windows Server 2012 R2 is an involved process which I will detail now.

  1. image[3]Disable IE Enhanced Security Configuration
  2. Download Visual Basic 6.0 Enterprise ISO from your MSDN subscription
  3. Download Visual Basic SP6 from here
  4. Right-click the ISO
  5. Select Mount
  6. Right-click setup.exe from the mounted drive
  7. Select Properties
  8. Click the Compatibility tab
  9. Check the Run this program in compatibility mode for: checkbox
  10. Select Windows XP (Service Pack 3)
  11. Click Apply
  12. Click OK
  13. Right-click on setup.exe
  14. Select Run as administrator
  15. imageClick Run the program without getting help
  16. Click Next
  17. Select I accept the agreement
  18. Click Next
  19. Enter your product ID (download from MSDN)
  20. Click Next
  21. Click Next
  22. Click Run the program without getting help
  23. Click Continue
  24. Click OK
  25. Click Custom
  26. Uncheck Microsoft Visual SourceSafe 6.0
  27. Click Continue

This is where things get interesting.  This installation will eventually hang updating the system.

image

Once you reach this point, kill the installation and restart your machine. Once your machine restarts:

  1. Right-click the ISO and select Mount
  2. Right-click on setup.exe
  3. Select Run as administrator
  4. Click Run the program without getting help
  5. Click Next
  6. Select I accept the agreement
  7. Click Next
  8. Enter your product ID (download from MSDN)
  9. Click Next
  10. Click Next
  11. Click Run the program without getting help
  12. Click Continue
  13. Click OK
  14. Click Custom
  15. Uncheck Microsoft Visual SourceSafe 6.0
  16. Select Data Access
  17. Click Change Options
  18. Uncheck everything except Data Environment
  19. Click OK
  20. Click Continue
    This time the installation should complete as expected.
  21. Click Restart Windows

Now we need to install Service Pack 6.

  1. imageRight-click on vb6sp6b.exe
  2. Select Properties
  3. Click Unblock
  4. Click OK
  5. Right-click on vb6sp6b.exe
  6. Select Run as administrator
  7. Enter C:\Users\{user}\Downloads\temp
  8. Click OK
  9. Click Yes
  10. Right-click setupsp6.exe from the C:\Users\{user}\Downloads\temp folder
  11. Select Properties
  12. Click the Compatibility tab
  13. Check the Run this program in compatibility mode for: checkbox
  14. Select Windows XP (Service Pack 3)
  15. Click Apply
  16. Click OK
  17. Right-click on setupsp6.exe
  18. Select Run as administrator
  19. Click Continue
  20. Click I Agree
    The installation should complete as expected.

The final step for VB6 is to make sure the installation folder is in the path and VB6 is registered as a capability.

  1. Open Windows Explorer
  2. Right-click the PC node
  3. Select Properties
  4. Click the Advanced system settings link
  5. Click the Environment Variables button
  6. Double-click Path  in the System variables list
  7. Append ;C:\Program Files (x86)\Microsoft Visual Studio\VB98
  8. Click OK
  9. Click New…
    Field Value
    Variable name VB6
    Variable value C:\Program Files (x86)\Microsoft Visual Studio\VB98
  10. Click OK
  11. Click OK
  12. Click OK

To test our installation we will create a “Hello World” program.

  1. Press the Windows key
  2. Type CMD
  3. Press Enter
  4. Type vb6
  5. Press Enter
    If Visual Basic does not start, repeat the setup to add the installation folder to the path and restart the command window.
  6. Select Standard EXE
  7. Click Open
  8. Change form caption to Hello World!
  9. From File menu, select Save Project
  10. Create a folder and save your project
  11. Close Visual Basic

We need to check this project into Visual Studio Team Services.  I am going to explain how to use Team Foundation Source Control.  If you prefer, you can use Git.  I am just assuming if you are using VB6 you might not have made the move to Git just yet.

  1. Log into Visual Studio Team Services
  2. Click New
    Field Value
    Project name {anything you like}
    Description {anything you like}
    Process template {anything you like}
    Version Control Team Foundation Version Control
  3. Click Create project
  4. Click Navigate to project
  5. Click Add Code

With our team project and Team Foundation Version Control repository created, we can add our code to Visual Studio Team Services.

  1. Start Visual Studio 2015
  2. Click Team Explorer tab
  3. Click Manage Connections
  4. Click Connect to Team Project
    image
  5. Select your server, collection, and project
  6. Click Connect
  7. Click Configure your workspace
    image
  8. Click Map & Get
  9. Open Source Control Explorer
  10. Copy your Hello World project into the mapped folder
  11. Click the Add Items to Folder
    image
  12. Select the folder for your project
  13. Click Finish
  14. Right-click the new folder
  15. Select Check In Pending Changes 
    image
  16. Click Check In

With Visual Basic 6.0 Enterprise installed and our project in Visual Studio Team Services, we can now install the build agent.

  1. Return to Visual Studio Team Services
  2. Click the Manage project gear in the upper right-hand corner of the screen
    image
  3. Click your account name
     image
  4. Click Agent queues tab
  5. Click Download agent
  6. Save the file to your Downloads folder
  7. Right-click agent.zip
  8. Select Properties
  9. Ensure the file is unblocked
  10. Click OK

With the zip downloaded, we can use it to stamp out agents.

  1. Right-click agent.zip
  2. Select Extract All
  3. Enter c:\a1
  4. Click Extract

I number my folders because you can have multiple agents installed on a single machine. I tend to install one agent per core.

  1. Press the Windows key
  2. Type CMD
  3. Right-click Command Prompt
  4. Select Run as administrator
  5. Navigate to the folder where you extracted the file contents
  6. Run ConfigureAgent.cmd
    You can either use the default name or have the name match the folder name, which in my case is “a1”
  7. Now enter your Visual Studio Team Services URL (https://{account}.visualstudio.com)
  8. Press Enter
  9. Press Enter
  10. Press Enter
  11. Sign in to your Visual Studio Team Services account

After you log in, the agent will be configured and begin running.  If you return to your Visual Studio Team Services account, you will see your new agent listed.

  1. Select the agent
  2. Click Capabilities
  3. Confirm the VB6 capability was listed
    image

Now to the easy part: creating the build to compile our VB6 application.

  1. Click the Build hubimage_thumb4
  2. Click the green plus 
  3. Select the Empty template
  4. Click Next
  5. Select your repository
  6. Check the box for Continuous integration
  7. Select Default agent queue
  8. Click Create

With the build created, we need to add the required tasks.

  1. Click Add build step…
  2. Select the Utility category
  3. Click Add next to the Command Line task
  4. Click Add next to the PowerShell task
  5. Click Add next to the Copy and Publish Build Artifacts
  6. Click Close 
  7. Select the Command Line task 
    Field Value
    Tool vb6
    Arguments /m /out errors.txt {project}.vbp
    Working folder [Browse to folder with {project}.vbp]
    Fail on Standard Error [Checked]

    You must use /out or a dialog will be display on any error and your build will hang.
  8. Select the PowerShell task
    Field Value
    Type Inline Script
    Inline Script
    if(Test-Path .\errors.txt)
    {
       $file = Get-Content .\errors.txt 
       Remove-Item .\errors.txt
    
       if($file | Select-String "succeeded." -quiet) { exit 0 }
    
       $file | Where-Object {Write-Host "##vso[task.logissue type=error]$_"}
    }
  9. Select the Copy and Publish Build Artifacts task
    Field Value
    Contents *.exe
    Artifact Name drop
    Artifact Type Server
  10. Click Repository tab
  11. Update Mappings to project folder
  12. Delete cloaked entry
  13. Click Trigger tab
  14. Update Filters to project folder
  15. Click General tab
  16. Click Add Demand
    Field Value
    Name VB6
    Type exists

    This makes sure that only the agent that has Visual Basic 6.0 installed is selected to run this build.
  17. Click Save
  18. Name build
  19. Click OK
  20. Click Queue build…
  21. Click OK

Once the build is done you can browse the artifact to see the exe produced by the build.

image

You can use this technique to build any language using Visual Studio Team Services.

Comments (13) -

  • Mario Betancourt

    8/30/2017 9:32:21 PM | Reply

    It worked for me, partially, the .exe file is maked in the C:\Users\TFSAdmin\Documents folder, do you know how to fix it?

    Thanks for the post.

  • Junior

    12/28/2017 10:50:11 PM | Reply

    My build get locked on the compile vb6 task. Do you know why?

    Best regards!

    • Donovan

      2/2/2018 6:16:01 PM | Reply

      Make sure you pass in all the correct flags. Otherwise it will try and show a dialog and your build will hang.

  • Audberto

    7/10/2018 12:17:26 AM | Reply

    Hi Donovan.

    Thanks a lot for this article.

    Do you know if VB6 can be installed on Windows Server 2012 Standard?

    Best Regards

    • Donovan

      7/10/2018 3:37:53 PM | Reply

      I have no idea.  I only did this post to prove the point that VSTS works for any language and any platform. I don't code in VB6 so I have no reason to install it anymore.

    • Michael Dang

      9/12/2018 7:14:02 PM | Reply

      Hi Audberto,

      Did you try this?   What was your result?

    • Antaryami

      11/3/2019 6:55:30 PM | Reply

      Yes, it can be installed on Windows Server 2012 and it is working fine. However, I don't really remember the Server edition.

  • Kirsten Greed

    2/20/2019 6:38:54 AM | Reply

    I had to uncheck Data Access , otherwise the VB6 install locked up on "setup is updating your system"

    • Kirsten Greed

      2/20/2019 6:54:56 PM | Reply

      Oops, I didn't read the instructions properly. Steps 16 to 18

  • Sean Cooney

    5/31/2019 9:19:01 PM | Reply

    Can this be done using Azure DevOps?

    • Donovan

      6/1/2019 1:34:12 PM | Reply

      Yes. Azure DevOps is just a new name for VSTS. The engine and concepts are the same.

  • Jay Stuart

    3/11/2020 8:56:10 PM | Reply

    For me when installing Visual Basic 6.0 Professional/Enterprise, I don't uncheck all of data access.
    What I unselect is the following:
      Microsoft Visual SourceSafe 6.0  (if available)
      under "Data Access"
          "Remote Data Objects"
      "Professional Features and Tools"
          This contains "Visual Component Manager" (is no longer supported by MS) and "Repository" (never used)

    While performing the first install, if you use a tool such as Process Monitor, you will see the installer hitting an Access Denied trying to delete a registry key that is related to Remote Data Objects (RDO).  Opening up the permissions on that key so that the process can delete it, allows the installation to complete successfully.  That key is "HKEY_CLASSES_ROOT\RDSServer.DataFactory\Clsid"
    This eliminates the need to try a second install.
    Also note that I install all of the latest patches and service packs for VB6, not just SP6.

  • L H Ferguson

    10/20/2020 10:37:34 PM | Reply

    The lockup when installing VB6 is usually caused by the installer trying to find and install the old MS variant of Java.  If you create a zero-length file C:\Windows\MSJAVA.DLL before installing VB6, and don't select any Java related options in the installation, it should go thru without any problems - except for the issues related to database options, ADO, RDO etc.

Pingbacks and trackbacks (2)+

Add comment

Loading