Sunday, August 2, 2009

Part IV: Step by step procedure of how to install an assembly

Posted on/at 7:34 AM by Admin


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 anapplication 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 
clip_image001
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:
clip_image002
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.
clip_image003
Figure 3

Now, expand the Merge module properties grid and set the author name, for example, "Me" as the figure shows bellow:
clip_image004
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
clip_image005
Figure 5

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

Select the Merge Module 1 project in the combo box list as shown bellow:
clip_image007
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.
clip_image008
Figure 8
The install process will be launched.
clip_image009
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.
clip_image010
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.

0 comments:

Post a Comment

About Me

Developers house is a blog for posting technical articles in different technology like Microsft, Java, Oracle ..etc Microsoft technology includes c#,VB.net,ASP.net,Ajax,SilverLight,TFS,VS.NET 2003,2005,2008,2010 , SQL Server 2000, 2005 , Expression Blend , ...etc I hope it is helpful for all of you and if you are interested to post articles on it, only send me at ahmad.eed@gmail.com