UNDERSTANDING CONCEPT BEHIND .EXE AND .DLL IN C#


Today in Engineer's World, we are discussing a very important topic of C# in very easy way. Posted By- +Manish Kumar Gautam +LIVE VIAR +ASP.NET SOLUTIONS

Click imagination hunt to see latest Blogs

Previous – Assembly in.NET

.exe and .dll in C#

To understand concept of .exe and .dll. Open up you Visual Studio. And Copy down the steps that we are performing.

Step1: Open a Console Application in VS.
Under main method. Write the code
 
Figure-1

Step 2: Now Build Solution or Press F6.
You will see the output for this code by pressing Ctrl+F5
 
Figure-2

Step 3: Now, go to the project AspnetSolutions in the Solution Explorer (that is in the upper right hand corner of the VS window)
 
Figure-3

Step 4: And if it is missing you can find it in
 
Figure-4

or you can directly make use of shortcut keys- Ctrl+W, S.

Step 5: After getting the Solution Explorer what you have to do is Right Click and Open Folder in File Explorer. 
 
Figure-5

Step 6: Then, click on bin Folder then open the Debug Folder. You will find that you have a AspnetSolutions project Application. This appear because you have mentioned some information in Main Method().
 
Figure-6


Step 7: If you Right Click on this file to check its properties. You will find this information, which says- Type of File is (.exe) i.e. executable file.
 
Figure-7

Step 8: Now, to see its .dll. Click on the properties option in the Solution Explorer. In there you will find Output type: which is Console Application by default. Change it to Class Library and save it (Ctrl+S).
 
Figure-8

Step 9: Now, Again Build the solution Press F6. And if you try to see the output for this code as by pressing Ctrl+F5. You will face this error. Don't worry about this... just read what it says. And you will yourself understand this till you reach to this Blog end.
 
Figure-9

Step 10: Now, again check the Debug folder, you will find AspnetSolutions.dll File, i.e. Application Extension.
 
Figure-10

Final Step: If you Right Click on this file to check its properties. You will find this information, which says- Type of File is (.dll) i.e. Application Extension.
 
Figure-11

By this we end up.


For any query, comment us below.


Related Question:


Q-1 What is an Application Extension?
Ans. Application Extension means it is not an application. It is an extension of this application that can be used in some other application.

Q-2 What are the differences between .exe and .dll?
Ans.  

 
Q-3 Why is the reason for the Figure-9 error?
Ans. In this Case as we have change the Output type from Console Application to Class Library, what happening is- the .exe file change to .dll file. And we know .dll doesn't contain a Main(), and if a file is not having a Main() it is never going to be execute, but if you want to use a .dll you have to use within an .exe.

Click imagination hunt to see latest Blogs

Keep learning and sharing...

Comments

Popular posts from this blog

SSC CGL 2016 Tier-1 Marks / Result

DATA TYPES IN C#

Pattern printing program

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Top Mutual Funds

SSC CGL 2017 TIER 2 RESULT OUT

JUST IN TIME (JIT)

Can we have multiple Main methods in one class

TOP 15 VISUAL STUDIO SHORTCUT KEYS

Top 10 Interview Tips and Questions