ONE OF LAST PHASES in an application's development cycle is the deployment process. While developing, testing, and debugging an application, many developers suddenly realize that they must deploy their application to a number of workstations. If you don't think of the deployment process while you're developing your application, you may run into surprises when you attempt to install the application on another machine. As you code the application, you make changes to the development environment. You may install a peculiar font (an OCR font, for example), use icons from the folder in which they exist, install custom components on the development machine's global assembly cache (GAC), and so on. When the application is deployed to a target machine, it may not find a drive or folder that existed on the development machine, or a component that's not installed in the target machine's GAC.
You should always keep in mind that your application will be distributed to other people's workstations. If you're using icons, for example, place them first in a folder under the project's Bin folder and then use them. Distribute the folder with the icons along with the application's executable files, to make sure that your code will find the icons. In addition, you should decide on your deployment method early in the process and deploy the application to a production machine from time to time. Production machines are set up differently than development machines, and you'll be surprised how often an application that works as expected in the development environment misbehaves when installed on a production machine. The problem is usually simple to resolve (most often components that have been installed on the development machine, but not on the target machines), but you shouldn't postpone the deployment problems to the very end of the cycle.
In this chapter we're going to explore the various deployment techniques for .NET Windowsbased applications. There are two common deployment scenarios:
Applications that will be distributed in a corporate environment
Applications that will be distributed to the general public
Most developers write applications that will be used within their corporation, and we'll focus on a technique for deploying applications in a fairly controlled, trusted environment. You'll also learn how to create setup programs to distribute your .NET applications to the public.