Last post Sep 26, 2016 09:06 AM by Deepak Panchal
Sep 14, 2016 01:13 PM|SkyDriving|LINK
Hi, I am using VS2015. How to I use it to create a DLL and use it in my Project.
Please show me an example to do it and use it.
Sep 14, 2016 10:25 PM|PaulTheSmith|LINK
(FWIW the name is 'assembly' in .Net, not 'dll')
If your code is valid c# then going to the 'Build' menu and choosing 'Build Solution' will create the assembly for you. By default each Project in your solution becomes an Assembly.
If one project adds a reference to another project (Right Click on references => Add Reference...) then it can be used in that project.
Sep 15, 2016 01:41 AM|Deepak Panchal|LINK
Hi Sky Driving,
Step 1:- File->New->Project->Visual C# Projects->Class Library. Select your project name and appropriate directory click OK.
After Clicking on button ‘OK’, solution explorer adds one C# class ‘Class1.cs’. In this class we can write our code.
When we double click on Class1.cs, we see a namespace CreatingDLL. We will be use this namespace in our project to access this class library.
Step 2:- Within Class1.cs we
create a method named ‘demosum’ that takes two integers value and return sum to which method passed numbers.
Step 3:- Now build the Application and see bin\debug directory of our project. ‘CreatingDLL.dll’ is created.
Now we create another application and take this DLL (CreatingDLL.dll) reference for accessing DLL’s method.
Step 4:- File->New->Project->Visual C# Projects->Web Form Application.
Step 5:- Designed your Web Form.
Step 6:- Add
reference of DLL (CreatingDLL).
After adding reference of DLL, it will appear in References section.
7:- Write code on button click
of Web Form Application. Before creating object and making method of Add DLL, add namespace CreatedDLL in project as bellow code.
8:- Now build the application and execute project.
Sep 22, 2016 11:02 PM|SkyDriving|LINK
can you show me one example of DLL that accept parameters to output to caller.
the dll contain below code:
private async System.Threading.Tasks.Task<byte> getHttpAsBytesAsync(string url)
var request = WebRequest.CreateHttp(url);
request.UseDefaultCredentials = true;
var response = await request.GetResponseAsync();
using (var br = new BinaryReader(response.GetResponseStream()))
using (var ms = new MemoryStream())
var lineBuffer = br.ReadBytes(1024);
while (lineBuffer.Length > 0)
ms.Write(lineBuffer, 0, lineBuffer.Length);
lineBuffer = br.ReadBytes(1024);
bytes = new byte[(int)ms.Length];
ms.Position = 0;
ms.Read(bytes, 0, bytes.Length);
private async System.Threading.Tasks.Task<BitmapImage> convertBytesToBitmapAsync(byte bytes)
//convert to bitmap
var bitmapImage = new BitmapImage();
var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
Sep 23, 2016 12:54 AM|PaulTheSmith|LINK
A dll does not accept parameters. An assembly is a file. Files do not take parameters. An assembly is a type of file which contains partially compiled code.
A method can accept parameters. The two methods you have shown are both examples of methods which accept a parameter and return a result to the caller. The methods you have shown (like all methods) would need to be stored in an Assembly (either .exe or
.dll) in order to e called.
What are you trying to do?
What problem do you have?
Sep 23, 2016 02:20 AM|SkyDriving|LINK
I wanted to create a DLL contain methods just like the pre-built class like System.IO or methods stored in an Assembly (either .exe or .dll) in order to e called.
This is for security reason. can you help to show how to do it?
Sep 23, 2016 07:21 AM|PaulTheSmith|LINK
Deepak has shown you the steps in tiny detail. Which exact step do you have a problem with? Tell us what you did, what happened and what you wanted to happen.
If you have a security problem that you want help with then you should tell us what the security issue is. Don't ask us how to implement a solution which is not actually going to solve your problem. Tell us the
Sep 23, 2016 01:55 PM|SkyDriving|LINK
Step 7:- Write code on button click of Web Form Application. Before creating object and making method of Add DLL, add namespace CreatedDLL in
project as bellow code.
Where to add this namespace?
Sep 26, 2016 09:06 AM|Deepak Panchal|LINK
you had asked where to add Namespace.
you need to add namespace at the top of the page where other namespace are mentioned.
then you can access and use the content and functions of that DLL in that page.
you can see in the picture to get the idea where you have to add namespace.