Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Photos | Blogs | Beginners | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
DevExpress UI Controls
Search :       Advanced Search »
Home » ASP.NET and Web » Assemblies in ASP.Net

Assemblies in ASP.Net

In this article we will discuss what assembly is and why we use it.

Author Rank :
Page Views : 517
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Discover the top 5 tips for understanding .NET Interop
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 


HTML clipboard

Assemblies

An assembly is the actual .dll file on our hard drive where the classes in the .NET Framework are stored. For example, all the classes contained in the ASP.NET Framework are located in an assembly named System.Web.dll. In other word, an assembly is the primary unit of deployment, security, and version control in the .NET Framework. The .NET Framework (version 2.0) includes 51 assemblies.

There are two types of assemblies:
 

  • Private: A private assembly can be used by only a single application.
     
  • Shared: A shared assembly can be used by all applications located on the same server.

Shared assemblies are located in the Global Assembly Cache (GAC). For example, the System.Web.dll assembly and all the other assemblies included with the .NET Framework are located in the Global Assembly Cache. GAC is physically located in our computer's \WINDOWS\Assembly folder. There is a separate copy of every assembly in your \WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder. The first set of assemblies is used at runtime and the second set is used at compile time.

Before we can use a class contained in an assembly in our application, we must add a reference to the assembly. By default, an ASP.NET application references the most common assemblies contained in the Global Assembly Cache:
 

  • mscorlib.dll
  • System.dll
  • System.Configuration.dll
  • System.Web.dll
  • System.Data.dll
  • System.Web.Services.dll
  • System.Xml.dll
  • System.Drawing.dll
  • System.EnterpriseServices.dll
  • System.Web.Mobile.dll

To use any particular class in the .NET Framework, we must do two things. First, our application must reference the assembly that contains the class. Second, our application must import the namespace associated with the class. In most cases, we won't worry about referencing the necessary assembly because the most common assemblies are referenced automatically or say by default. However, if we need to use a specialized assembly, we need to add a reference explicitly to the assembly. For example, if we need to interact with Active Directory by using the classes in the System.DirectoryServices namespace then we will need to add a reference to the System.DirectoryServices.dll assembly to our application.

Each class entry in the .NET Framework SDK documentation lists the assembly and namespace associated with the class. For example, if we look up the MessageQueue class in the documentation, we will discover that this class is located in the System.Messaging namespace located in the System.Messaging.dll assembly.

If we are using Visual Web Developer, we can add a reference to an assembly explicitly by selecting the menu option Website, Add Reference, and selecting the name of the assembly that we need to reference.

For example, to add a reference to the System.Messaging.dll assembly results in the web configuration file as given below.

 
<?xml version="1.0"?>
<configuration>
  <
system.web>
    <
compilation>
      <
assemblies>
        <
add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </
compilation>
  </
system.web>
</
configuration>

 

If we prefer not to use Visual Web Developer, then we can add the reference to the System.Messaging.dll assembly by creating the above file by other hand.

HAVE A GREAT CODING!

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Abhimanyu Kumar Vatsa
http://www.itorian.com/about/
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
Team Foundation Server Hosting
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.