Distribute .NET Applications That Use Excel

Use the Visual Studio .NET Setup and Deployment project to create an installation program for applications that use Excel as a component. (See "Distribute .NET Components" for a walk-through of using the Setup Wizard.)

How to do it

The .NET setup tools detect the .NET Frameworks and Excel PIAs as dependencies of any application that uses Excel as a component and includes those files with the installation. However, the setup tools do not automatically check for the installation of Microsoft Excel or any other Microsoft Office product.

To verify that Excel is installed before installing your .NET application, add a launch condition to your installation project. To do this, create an installation project in Visual Studio .NET and follow these steps:

  1. Select the installation project, then click the Launch Conditions Editor in the Solutions Explorer (Figure 5-12).

    Adding a launch condition to an installation project

    Figure 5-12. Adding a launch condition to an installation project

  2. In the Launch Condition window, right-click Search the Target Machine and select Add File Search. Visual Studio .NET creates a file search item and displays its properties (Figure 5-13).

    Setting the File Search properties to find Excel 2003

    Figure 5-13. Setting the File Search properties to find Excel 2003

  3. Set the FileName, Folder, and MinVersion properties, ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.