How to create a dll in dotnet

To get something you never had, you have to do something you never did-Bimal Patel

Wednesday, December 29, 2010

How to create a dll in dotnet?

follow the steps below  to know how to create and  use the dll

1)open visual studio



2)click on New in file menu and choose project

3)click on visual c#  in the left handside from project types and choose class library from templates in right hand side


4)Now you get the screen as follows change the name of class1.cs from solution explorer to Test.cs


5)Now include the code in Test.cs as in the image


6)Now to build options and click on Build Assembly demo


7)once you build your project, go to project folder on your computer  go to bin--> debug folder now here
you can see  two files ,so the file with extension .dll is the  assembly file.

Now we got the dll files ,what to do now?

Let see procedure how to use(consume) dll in any of the applications,i am doing it in a website

8)open visual studio,go to File--->;New--->Website and you get below screen,give a name to your website



9)Now you get a screen as below

10)Go to solution explorer ,right click on the project , choose  Add reference from  list of options,then  in the immediate window choose browse  option   and move to your debug folder as discussed in step 7,choose the file with .dll extension and click ok


11)Go to  your default.cs page ,add a namespace  "using AssemblyDemo"  at the top


 12)Add the following code in your page load event


13)Run your website the final output will be as follows

No comments:

Post a Comment