Tuesday, February 26, 2008

How To Create A Simple Shared Assembly in .NET

STEP 1 :

Start - > Microsoft Visual Studio 2005 - > Create Project - >New Project DialogBox - >Select

Class Library (Visual C#) add code in Your class file then complie it.

STEP 2:
Start - > Microsoft Visual Studio 2005 - > Visual Studio Tools -> Visual Studio 2005

Command Prompt

move on to project folder location

For Example:

If You Create A Project By Name Example, Your Project Saved in the following location

E:\Example\Example\bin\Debug> ,in Visual Studio 2005 Command Prompt type the following

E:>Cd E:\Example\Example\bin\Debug

create shared name file for your dll by typing the follwing line

E:\Example\Example\bin\Debug> sn -k userdefinedname.key

Example=E:\Example\Example\bin\Debug> sn -k Example.key

The Key Will Be Created Within Debug Folder in the name Example.key

STEP 3:

Goto project solution properties

Click "Signing" Tab (First From Buttom).

Check Sign the assembly

Choose a Strong Name Key File dropdown , then select browse "Example.key", after going to

Debug Folder,in the Select File Dialog Select All Files(File TYpe).

save and then Compile the project

STEP 4:

Start - > Microsoft Visual Studio 2005 - > Visual Studio Tools -> Visual Studio 2005

Command Prompt Example=E:\Example\Example\bin\Debug> gacutil /i .dll


STEP 5 :

After hosting the assembly just go to WINNT\Assembly folder and you will find your

assembly listed there

No comments: