Part IV: Step by Step Procedure of How to Install an Assembly

Introduction

Now, we will see how to install an assembly using the merge module witch is a tool provided by the MS Visual Studio 2005. The merge module tool is used to wrap components designed especially in order to be shared later. Components can be dll files or user controls objects that are consumed, in general, by the developer who wants to use or reuse already existing components, for example, he can develop an application against given dll files. So, using this method can provide him possibility to enjoy with those dll's or component's services.

Assuming that we want deploy an assembly witch called ClassLibrary1 with this feature:

using System;

using System.Collections.Generic;

using System.Text;

using System.Windows.Forms;


namespace
ClassLibrary1

{

    public class Class1

    {

        public Class1()
        {

             MessageBox.Show("You are using ClassLibrary1");

        }

    }
}

After building it, we save the project and we add a new one by clicking File, New and Project



Untitled-1.gif

Figure 1

After the merge module project is opened, select Module Retarget able Folder just at right under the File system target machine node, then, right click and select add, then select project output as the figure shows bellow:

Untitled-2.gif

Figure 2

Select the primary output element list representing the assembly that we want to deploy. If you want to deploy other elements such as documentation files to get support to the developers or XML serialization assemblies, you can add them with the primary output.

Untitled-3.gif

Figure 3

Now, expand the Merge module properties grid and set the author name, for example, "Me" as the figure shows bellow:

Untitled-4.gif

Figure 4

There is a property witch I find very useful by the way, I mean, the "Search Path" property used to determine the path used to localize assemblies, files or even merge modules on the development computer.

Now, build the solution and browse to the application directory, the merge module project with name "MergeModule1" is there. Browse to the debug file an open it. A file with *.msm extension is created; this file represents the merge module project output. The mission is not completely accomplished because the merge module can not be installed directly. To install it, we must add an Installer project in order to consume the merge module; in fact, this one can't be installed by its self.

So, add a new setup project by selecting File then Add then New Project, and select Setup Project

Untitled-5.gif

Figure 5

Now, select Application Folder then Add then Project output menu item and click on it.

Untitled-6.gif

Figure 6

Select the Merge Module 1 project in the combo box list as shown bellow:

Untitled-7.gif

Figure 7

Expand the setup properties grid and change the author property "." By "Me" and the Manufacturer property value "." By "Me" before build the project, otherwise, it can not be installed later. Build the setup project. After that, select it, right click and choose install in the context menu and click on it.

Untitled-8.gif

Figure 8

The install process will be launched.

Untitled-9.gif

Figure 9

After the project deployment, swap to the configuration panel and open add and remove program. You can find the setup 1 among the installed programs.

Untitled-10.gif

Figure 10

The developer, or let us say the intermediate user, can browse to %root%\ProgramFiles\Me, there, he can find the new installed dll file.

Up Next
    Ebook Download
    View all
    Learn
    View all