How to Make & Use (.dll) files in Visual Studio | Using Class Library

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello youtube and welcome to this video in this video we're gonna learn how we can create a dll file in visual studio and how we can use it and utilize it in our projects so let's begin open the visual studio and create new project and we're gonna select class library of dotnet favorite naming this a relevant name is very necessary I'm naming it Cal U later and create new project so the project is here first thing you have to do is delete this class and create a new class go to add and class and name it functions you can name it whatever you want I'm making this class a static class it's not necessary but it will come in handy and you should make the I'm making this class static because I have to make all the methods inside it static if you are not making all the matter inside its static just don't make it static so static void add I'm choosing this simple function so I can demonstrate it easily and yoga and you guys can understand it easily so num2 and it's gonna return our double so return it's only function is to return the sum of these two parameters so plus and return this so I'm gonna copy this and paste it a few times and here we have developed for functions of a simple calculator so debts gonna be inside my DLL file to create the DLL file you have to go to build and build solutions so it is built successful now here is our project calculator coincide this and bin-debug and here is our dll file so I am gonna store it here to use it in our next project so I am going to close the visual studio for now and I am gonna start a new project and this time it's gonna be a console application but you can use whatever you want windows form a WPF or any other dotnet framework for simplicity I am using console application of dotnet framework so click Next and I'm gonna name it calculator app and create the project so here is our project the first thing you should do is copy this and go to the calculator app which we have created recently the console application and paste the dll file here these are the project files now when you have based a dll file go to solution Explorer and add references if you don't have the solution of clover here you can go here there's all sort of windows like the property window and toolbox window and here is the solution after window so you can search the windows here so add reference browse go to where you have pasted a dll file which is console app and here is our DLL file so add this to your project make sure this is checked click OK now we can use the DLL file which is named as calculator so using calculator so using calculator it's not showing the calculator and I'm gonna show you what is the problem here so we're going to start the old project again which was the calculator so here is our function here is our project so what was wrong here we didn't make this class public debt was wrong we should make the class and all of the functions all of the methods is public so first of all delete this and also delete the dll file which we had copied here and now we are gonna create the new one so build the build solution I had to show the error because if it is a most basic error if you don't make things public it would you would get into the trouble of not knowing what is wrong with your project so we have made it public and now let let's test the dll file so get into the calculator which was the class library project go to debug here is our new dll file copy this and here the calculator F which is the console application and here paste the dll file now close it and now we are going to test our application so now it shows calculator and we didn't even have to add the references again so it's now showing calculator now to use all of its function type function dot add + 4 + 10 are the numbers we are giving it and console.writeline to print the result also consult or treat key to hold the result and copy it and paste it here : and now we are going to copy paste it and change the function to subtract multiply divide and now it is complete but let's give this some relevant number so the divide looks good so 10 here and 2 here and also in the subtract give 10 here and 4 here now start the application and now you can see the result of some subtract and multiply and divide so these are all the results thank you for watching the video and if you liked the video press the like button and also please subscribe the channel and see you next time
Info
Channel: The Amazing Codeverse
Views: 139,199
Rating: undefined out of 5
Keywords: dll, dll file visual studio, dll file using class library, class library, how to make dll file, how to edit dll file, import dll file visual studio, use dll file in project, add reference visual studio, visual studio c#, make and use dll file c#, import export dll file, create .dll file, create .dll file visual studio, create dll file and use it c#, vb.net dll file, use dll file vb.net, dll file java, python, php, .dll file c#, class library dll file
Id: MPOuci-6amQ
Channel Id: undefined
Length: 11min 48sec (708 seconds)
Published: Sat May 25 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.