Walkthrough: Installing Shared Components Using Merge Modules
TOC
Collapse the table of content
Expand the table of content

Walkthrough: Installing Shared Components Using Merge Modules

Merge modules (.msm) are used to install components that are shared by multiple applications—for example, components (such as DLLs, controls, resources) that developers use in applications. In contrast, Windows installers (.msi) are used to install applications and files (such as executable files, documents, HTML pages), and are typically used by the end user of the application.

By using merge modules, you can help ensure that shared components are packaged and delivered for consistent deployment. You can use the module's retargetable folder to place files into the same directory as your application, but you can also opt to place files to another directory, such as the Start Menu.

This walkthrough demonstrates how to package a component in a merge module and to consume that merge module in a setup project.

NoteNote

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To create a component

  1. On the File menu, point to New, and then choose Project.

  2. In the New Project dialog box, select Visual C# Projects in the Project Type pane, and then choose Class Library in the Templates pane. In the Name box, type MyComponent.

  3. Click OK to close the dialog box.

  4. On the Build menu, choose Build MyComponent to build the class library.

To create a merge module project

  1. On the File menu, point to Add, and then choose New Project.

  2. In the Add New Project dialog box, select Other Project Types, select Setup and Deployment Projects in the Project Type pane, select Visual Studio Installer, and then choose Merge Module Project in the Templates pane. In the Name box, type Sample.

  3. Click OK to close the dialog box.

  4. In the File System Editor, select the Module Retargetable Folder. On the Action menu, point to Add, and then choose Project Output.

  5. In the Add Project Output Group dialog box, select the Primary Output of the MyComponent project. Click OK to close the dialog box.

  6. On the Build menu, choose Build Sample to build the merge module.

To add a Setup project that consumes the merge module

  1. On the File menu, point to Add, then click New Project.

  2. In the Add New Project dialog box, select Setup and Deployment Projects in the Project Type pane, and then choose Setup Project in the Templates pane. In the Name box, type Merge Module Installer.

  3. Click OK to close the dialog box.

  4. In the File System Editor, select the Application Folder. On the Action menu, point to Add, and then choose Project Output.

  5. In the Add Project Output Group dialog box, select the Sample project, then select Merge Module.

  6. Click OK to close the dialog box.

    Note that the merge module (Merge Module from Sample (Active)) is not added to the folder. Instead, it is added to the Merge Module Installer project in Solution Explorer. This is because merge modules cannot be installed directly; they must be merged into an installer.

  7. Select the merge module in Solution Explorer. In the Properties window, expand the KeyOutput node, then expand the (Merge Module Properties) node, and select the Module Retargetable Folder property.

    NoteNote

    The properties beneath the KeyOutput property are dynamic properties that do not appear until the merge module has been built.

  8. Click the drop-down list for the Module Retargetable Folder property and select (Browse...) to display the Select Folder dialog box.

  9. In the Select Folder dialog box, choose Application Folder. Click OK to close the dialog box.

  10. On the Build menu, choose Build Merge Module Installer.

To install on your development computer

  • Select the Merge Module Installer project in Solution Explorer. On the Project menu, choose Install.

    This will run the installer and install Merge Module Installer on your development computer. The installer will install the component contained in the merge module to the application directory.

    NoteNote

    You must have install permissions on the computer in order to run the installer.

To deploy to another computer

  1. In Windows Explorer, navigate to your project directory and find the built installer. The default project configuration is Debug or Release.

  2. Copy Merge Module Installer.msi, Setup.exe, and all other files and subdirectories in the directory to another computer.

    NoteNote

    To install on a computer that is not on a network, copy the files to traditional media such as CD-ROM.

    On the target computer, double-click the Setup.exe file to run the installer.

    NoteNote

    You must have install permissions on the target computer in order to run the installer.

To uninstall the application

  1. In Windows Control Panel, double-click Add or Remove Programs.

  2. In the Add/Remove Programs dialog box, select Merge Module Installer and click Remove.

  3. Click OK to close the dialog box.

    TipTip

    To uninstall from your development computer, on the Project menu of Visual Studio, choose Uninstall.

Community Additions

ADD
Show:
© 2016 Microsoft