Conclusion Introduction Deploying applications is hard. It takes time to build and test installers. Applications often require additional COM components to operate, and these components require registration. You also have to consider how you're going to physically distribute the bits.
Will you burn a CD? Will you zip them up and place them on a website for downloading? Will you use a product like SMS to push them out? Versioning applications is also hard. You may have previous versions of the application installed that may require removal.
Applications today are expected to somehow know when a new version is available, prompt you to see whether you want to install it, and then take care of the rest. Third-party products offer even more capabilities for deploying and versioning application, but automatic updating can be tricky. Rolling your own capability for this would be, for lack of a better term, hard. ClickOnce Deployment Automatic application updating is a feature that Microsoft has been working to simplify.
With Visual Studio and the. While this technology, known as ClickOnce deployment, was developed with. NET applications in mind, it can be used to automate the deployment and updating of Visual Basic 6. Considering that bazillions of lines of Visual Basic 6. If you already have Visual Studio installed, that's great!
Otherwise, I strongly recommend that you download and install the free Visual Basic Express. Visual Basic Express provides all the functionality that you need in order to ClickOnce deploy applications. It's a free, trimmed-down version of the full Visual Studio , but unlike typical evaluation software, it doesn't timeout. This article will walk you, step by step, through the process of ClickOnce deploying a Visual Basic 6 application.
This technique should work on other versions of Windows, but the steps for configuring Internet Information Server will vary slightly. NET application will become the launcher for your Visual Basic 6. It will check for, download, and install new versions automatically.
Click the File menu, and then click New Project. Create a Visual Basic Windows Application. Name the application MyAppLauncher. Click the File menu, and then click Save All. In the Save Project dialog box that appears, click Save. You should now see the form designer, which will let you create the launcher application. Initially, this will be a trivial application that will let you get familiar with ClickOnce deployment. Later, this will include your Visual Basic 6. In the Solution Explorer, double-click My Project.
Click the Publish tab on the left side. When you ClickOnce deploy your application, it will be posted on a website, allowing the user to download, install, and execute the application with a single click.
The application will also download and install any needed prerequisites, such as the. The default is to check before the application starts, but you can have the application check in the background while it's running. Configuring when to check for updates On the Publish tab, click Publish Now to compile and deploy the application to your local Web server.
Web installation page Little Details Unfortunately, at this point, it's necessary to pull back the covers on ClickOnce deployment just a bit, and talk about what's going on behind the scenes. Files published to the Web folder You'll notice some files with an. By default, Internet Information Server doesn't correctly serve these up, and as a result, if someone tries to install the application through the Web, it won't work.
There's a one-time change that you need to make to Internet Information Server's settings so that it correctly supports ClickOnce deployment. If you're running on a different operating system, the steps will vary slightly.
Click the Start menu, and then click Control Panel. Prompt for application install Click Install. The application will install and run. ClickOnce Deploying a Visual Basic 6. In the following steps, you will include a Visual Basic 6. Start Visual Basic 6. Change the caption property of Form1 to VB6 App. From the toolbox, add a Command button to Form1. In the Click event of the Command button, enter the following code: Save the project in the same folder as the MyAppLauncher.
Click the File menu, and then click Make Project1. In the Make Project dialog box, click OK. Switch to Visual Basic Express. Click the Project menu, and then click Add existing item. If you don't see Project1. In the Solution Explorer, select Project1. Press F4 to view the Properties window. In the Properties window, set the Copy to Output property to Copy if newer.
By adding the Visual Basic 6 executable to your Visual Basic. NET solution, and indicating that you want it copied to the output, you are ensuring that the Visual Basic 6 application will be included in your ClickOnce deployment. The only remaining task is to modify the launcher application so that it will launch the Visual Basic 6 application.
In the Solution Explorer, double-click Form1. Double-click Form1 in the designer to switch to code view. Close You can now publish the new version of the application. This time, the Visual Basic 6 application will be included with your launcher. Click the Publish tab. Visual Basic 6 application deployed through ClickOnce Versioning Now that you've completed the initial deployment of your Visual Basic 6 application, deploying a new version becomes simple. Essentially, you make changes to your Visual Basic 6 application, republish it, and that's it.
The following steps will walk you through the details: Switch to Visual Basic 6. In the Project Explorer, double-click Form1. Set the BackColor for Form1 to something obviously different, like red. Click the File menu, and then click Make project1. When prompted to replace Project1.
A new version has now been posted to the server. The next time the user runs the application, the new version will automatically download, install, and run. Don't install MyAppLauncher through the Web page. Instead, just launch the existing version through the Start menu. Application automatically checking for a new version A new version is detected automatically, and you're prompted to install.
Prompt to install the new version When you click OK, the new version installs and runs. New version of the Visual Basic 6 application Conclusion Hopefully, the technique shown in this article has opened a new door for how you deploy some of your applications.
In this first article, you have learned how to deploy a Visual Basic 6 application through ClickOnce deployment. About the author Scott Swigart spends his time consulting, authoring, and speaking about converging and emerging technologies. With development experience going back over 15 years, and by staying in constant contact with future software development technologies, Scott is able to help organizations get the most out of today's technology while preparing to leverage the technology of tomorrow.
Scott is also the author of several. Feel free to contact the Scott at scott swigartconsulting.