Deploying VSTO Add-Ins

You can deploy VSTO add-ins to customers in several ways including Windows Installer and ClickOnce (See Chapter 54, “Setup & Deployment Projects for Windows Installer,” and Chapter 55, “Deployingt Applications with ClickOnce”). The consideration you have to do is that VSTO add-ins require the full trust level. Because of this, deploying via Windows Installer can be a little bit more difficult than using ClickOnce because you have to set manually different settings. ClickOnce is instead more appropriate for at least three reasons:

• It is easy to configure and takes care of security settings for you; this is also the reason why Visual Studio automatically adds a test certificate to your solution when you first run it. Replacing the test certificate with a valid one contributes to granting full trust security settings.

• It provides a simple way for releasing updates.

• Starting from .NET 3.5 Service Pack 1, it sends installation error messages to the Windows Application log so that you can analyze the reason for eventual errors during the setup process.

Understanding ClickOnce

If you have never deployed applications via ClickOnce before, I suggest you read Chapter 55 first. In this particular situation we just mention the steps required to perform a ClickOnce publish but focus on more ClickOnce details in Chapter 55.

To deploy a VSTO add-in, select the Build, Publish command and then specify the target location, where Visual Studio generates the Setup.exe bootstrapper and a .Vsto file that installs your add-in on the target machine. It also generates an Application Files subfolder where the IDE places required files.

Visual Studio Requires Administrative Privileges

Differently from Visual Studio 2008, Visual Studio 2010 requires elevated administrative privileges to publish Office customizations via ClickOnce.

When you double-click the .Vsto file (or run Setup.exe), the ClickOnce installer guides you through the installation process. Figure 52.11 shows the step where ClickOnce asks for your confirmation before installing the customization.

Figure 52.11 ClickOnce confirmation request.

image

If there are any failures during the installation process, errors are sent to the Windows Application log reachable from the Windows Event Viewer (All Programs, Administrative Tools, Event Viewer). Figure 52.12 shows a sample message related to an error that occurred during the installation of an add-in.

Figure 52.12 The Windows Application log stores error messages from VSTO installations.

image

Logs are useful because you can check what happened in detail and focus on solving errors.

Summary

This chapter explained how to take advantage of the Visual Studio 2010 development environment to create .NET-based additional components for the Microsoft Office System. You saw how to distinguish between application-level solutions and document-level solutions; then you saw how it is simple to create add-ins for Microsoft Word, with a sample custom task pane, and Microsoft Excel writing Visual Basic 2010 code for the .NET Framework. Finally you got some information on deploying your add-ins using ClickOnce.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.20.240.124