Deployment
After you have built a great VSTO 2005 solution by customizing a Word document or Excel spreadsheet, you have to get the final bits of the code to your users somehow. But how? There are two broad classifications of deployment scenarios: local install and network install. Each has pros and cons.
Consider how this problem has traditionally been solved in the application programming world. In the traditional "rich client" or "thick client" application, all the application logic is stored in files that somehow get copied to the local machine. There might be a single .exe file, or the solution might have a number of .dll files associated with it that also need to be installed. When installing a thick client application, often the administrator or end user needs to run some kind of setup program to ensure that everything is registered and in the right location.
Rich client applications can take advantage of the full power of the client environment and are always available. Install an application, unplug your laptop, hop on a plane, and your applications are still there. However, that very strength is also a potential weakness; you have whatever version you installed, which is not necessarily the latest version. If your organization has many applications installed on many machines, ensuring that every machine is up-to-date can be a full-time job.
Exactly the opposite is true for "thin client" applications, where the application logic is on a network server somewhere. When the client logic is in the form of HTML and script downloaded fresh every time you refresh the page in the browser, updating every client is easy; just put the latest version on the Web server and every client will get it the next time he or she navigates the browser to your site. But thin client applications often squander the power of modern desktop and laptop computers by targeting a lowest-common-denominator platform that assumes nothing more than a browser; JScript was not designed for manipulating huge datasets. Thin client applications also frequently work poorly in disconnected scenarios, particularly if much of the application logic is on the server.
VSTO is all about taking full advantage of the power of locally installed Office applications. Because the customization assembly need not be in the same location as the document itself, VSTO cleanly supports both local installs (for offline scenarios) and network installs (for always-up-to-date scenarios). Furthermore, advanced users can take advantage of local caching of network-installed customization assemblies to get the best of both worlds: offline access to a locally cached customization assembly, but a guarantee that you are always using the latest version when connected.
This chapter covers how to use the Publish Wizard in Visual Studio to deploy applications to servers, how to create a setup project for a Word or Excel project, and how to use the ServerDocument object model to edit the deployment information inside a Word or Excel document. The chapter finishes up with a discussion of some of the advanced offline-caching scenarios.