|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Sending a Program in E-mail: Creating a Compressed (Zipped) File
In this lesson, you will learn how to package your program as a compressed (zipped) file and send it through e-mail.
Once you have finished your program, you might want to share your hard work with your friends and colleagues. Publishing your program to a CD-ROM or DVD using ClickOnce publishing is the best way to do this. If you do not have access to a CD or DVD burner, you may be able to distribute your program by packaging it in a compressed file and sending it through e-mail.
You should never open an attachment of any kind, including a .zip file, from a sender you do not trust. Unwanted or unsolicited attachments might contain viruses that can crash or hijack your computer, or steal your personal information. For similar reasons, you should not send your application to anyone who is not expecting it.
For most simple programs, you can package the executable file (.exe) and the configuration file (.config) in a compressed file and distribute it. For example, if you have a simple program named Calculator, you will need the Calculator.exe file and the Calculator.exe.config file, which you can find in the your Visual Studio Projects/Calculator/Calculator/bin directory, where your Visual Studio Projects is the directory that your Visual Studio projects are kept in, usually My Documents/Visual Studio/Projects.
All programs created with Visual Basic require Microsoft .NET Framework 3.5. If you distribute your program through e-mail, make sure that the .NET Framework is already installed on the computers of any recipients.
The .NET Framework is distributed with many other programs; it can also be downloaded from the Microsoft Web site. You can check if the .NET Framework is installed by going to the Control Panel, opening Add or Remove Programs, and looking for Microsoft .NET Framework 3.5.
For more complicated programs, such as programs that include a local database, you might need to include additional files. In this case, it is best to publish your program using ClickOnce publishing instead of sending it through e-mail.
The following procedure shows you how to compress a file using the default Compressed (zipped) Folders feature in Windows. If you installed a different program to work with .zip files, the steps needed to compress a file may be different.
To send a simple program through e-mail
Select a project that you have completed and run, and then in Windows Explorer, navigate to the project folder.
In the project folder, open the folder that has the name of the project, open the folder named Bin, and then select the Debug folder.
Select the ProjectName.exe file (where ProjectName is the name of your project), right-click the file, and choose Send To, Compressed (zipped) Folder.
A new file named ProjectName.zip is created and added to the directory. You can send this file as an attachment to an e-mail message.
In this lesson, you learned how to package your program for sending through e-mail. In the next lesson, you will learn how to extract and run a program that you have received.