What is a Manifest?
An assembly manifest contains all the metadata needed to
specify the assembly's version requirements and security
identity, and all metadata needed to define the scope of
the assembly and resolve references to resources and
classes. The assembly manifest can be stored in either a
PE (Portable Executable) file (an .exe or .dll) with
Microsoft intermediate language (MSIL) code or in a
standalone PE (Portable Executable) file that contains
only assembly manifest information. The following table
shows the information contained in the assembly
manifest. The first four items the assembly name,
version number, culture, and strong name information
make up the assembly's identity.
Assembly name: A text string specifying the assembly's
Version number: A major and minor version number, and a
revision and build number. The common language runtime
uses these numbers to enforce version policy.
Culture: Information on the culture or language the
assembly supports. This information should be used only
to designate an assembly as a satellite assembly
containing culture- or language-specific information.
(An assembly with culture information is automatically
assumed to be a satellite assembly.) Strong name
information: The public key from the publisher if the
assembly has been given a strong name. List of all files
in the assembly:
A hash of each file contained in the assembly and a file
name. Note that all files that make up the assembly must
be in the same directory as the file containing the
Type reference information: Information used by the
runtime to map a type reference to the file that
contains its declaration and implementation. This is
used for types that are exported from the assembly.
Information on referenced assemblies: A list of other
assemblies that are statically referenced by the
assembly. Each reference includes the dependent
assembly's name, assembly metadata (version, culture,
operating system, and so on), and public key, if the
assembly is strong named.
Creating a Key Pair?
You can create a key pair using the Strong Name tool (Sn.exe).
Key pair files usually have an .snk extension. To create
a key pair At the command prompt, type the following
In this command, file name is the name of the output
file containing the key pair. The following example
creates a key pair called sgKey.snk.
sn -k sgKey.snk
What is the difference between "using System.Data;" and
directly adding the reference from "Add References
When u compile a program using command line, u add the
references using /r switch. When you compile a program
using Visual Studio, it adds those references to our
assembly, which are added using "Add Reference" dialog
box. While "using" statement facilitates us to use
classes without using their fully qualified names.
For example: if u have added a reference to "System.Data.SqlClient"
using "Add Reference" dialog box then u can use
SqlConnection class like this:
But if u add a "using System.Data.SqlClient" statement
at the start of ur code then u can directly use
On the other hand if u add a reference using "using
System.Data.SqlClient" statement, but don't add it using
"Add Reference" dialog box, Visual Studio will give
error message while we compile the program.
What is GAC?
The global assembly cache stores assemblies specifically
designated to be shared by several applications on the
computer. You should share assemblies by installing them
into the global assembly cache only when you need to.
Assemblies deployed in the global assembly cache must
have a strong name. When an assembly is added to the
global assembly cache, integrity checks are performed on
all files that make up the assembly. The cache performs
these integrity checks to ensure that an assembly has
not been tampered with, for example, when a file has
changed but the manifest does not reflect the change.
Use a developer tool called the Global Assembly Cache
tool (Gacutil.exe), provided by the .NET Framework SDK
or Use Windows Explorer to drag assemblies into the
cache. To install a strong-named assembly into the
global assembly cache At the command prompt, type the
In this command, assembly name is the name of the
assembly to install in the global assembly cache.
What is a Metadata?
Metadata is information about a PE. In COM, metadata is
communicated through non-standardized type libraries.
In .NET, this data is contained in the header portion of
a COFF-compliant PE and follows certain guidelines;
it contains information such as the assembly’s name,
version, language (spoken, not computera.k.a., culture),
what external types are referenced, what internal types
are exposed, methods, properties, classes, and much
The CLR uses metadata for a number of specific purposes.
Security is managed through a public key in the PE’s
Information about classes, modules, and so forth allows
the CLR to know in advance what structures are
necessary. The class loader component of the CLR uses
metadata to locate specific classes within assemblies,
either locally or across networks.
Just-in-time (JIT) compilers use the metadata to turn IL
into executable code.
Other programs take advantage of metadata as well.
A common example is placing a Microsoft Word document on
a Windows 2000 desktop. If the document file has
completed comments, author, title, or other Properties
metadata, the text is displayed as a tool tip when a
user hovers the mouse over the document on the desktop.
You can use the Ildasm.exe utility to view the metadata
in a PE. Literally, this tool is an IL disassembler.
What is managed code and managed data?
Managed code is code that is written to target the
services of the Common Language Runtime.
In order to target these services, the code must provide
a minimum level of information (metadata) to the
All C#, Visual Basic .NET, and JScript .NET code is
managed by default.
Visual Studio .NET C++ code is not managed by default,
but the compiler can produce managed code by specifying
a command-line switch (/CLR).
Closely related to managed code is managed data--data
that is allocated and de- allocated by the Common
Language Runtime's garbage collector. C#, Visual Basic,
and JScript .NET data is managed by default.
C# data can, however, be marked as unmanaged through the
use of special keywords.
Visual Studio .NET C++ data is unmanaged by default
(even when using the /CLR switch), but when using
Managed Extensions for C++, a class can be marked as
managed using the __gc keyword. As the name suggests,
this means that the memory for instances of the class is
managed by the garbage collector.
In addition, the class becomes a full participating
member of the .NET Framework community, with the
benefits and restrictions that it brings. An example of
a benefit is proper interoperability with classes
written in other languages (for example, a managed C++
class can inherit from a Visual Basic class).
An example of a restriction is that a managed class can
only inherit from one base class.
What is .NET / .NET Framework?
It is a Framework in which Windows applications may be
developed and run. The Microsoft .NET Framework is a
platform for building, deploying, and running Web
Services and applications. It provides a highly
productive, standards-based, multi-language environment
for integrating existing investments with
next-generation applications and services as well as the
agility to solve the challenges of deployment and
operation of Internet-scale applications. The .NET
Framework consists of three main parts: the common
language runtime, a hierarchical set of unified class
libraries, and a componentized version of Active Server
Pages called ASP.NET. The .NET Framework provides a new
programming model and rich set of classes designed to
simplify application development for Windows, the Web,
and mobile devices. It provides full support for XML Web
services, contains robust security features, and
delivers new levels of programming power. The .NET
Framework is used by all Microsoft languages including
Visual C#, Visual J#, and Visual C++.
What is Reflection?
It extends the benefits of metadata by allowing
developers to inspect and use it at runtime. For
example, dynamically determine all the classes contained
in a given assembly and invoke their methods. Reflection
provides objects that encapsulate assemblies, modules,
and types. You can use reflection to dynamically create
an instance of a type, bind the type to an existing
object, or get the type from an existing object. You can
then invoke the type's methods or access its fields and
properties. Namespace: System.Reflection
What is "Common Type System" (CTS)?
CTS defines all of the basic types that can be used in
the .NET Framework and the operations performed on those
All this time we have been talking about language
interoperability, and .NET Class Framework. None of this
is possible without all the language sharing the same
data types. What this means is that an int should mean
the same in VB, VC++, C# and all other .NET compliant
languages. This is achieved through introduction of
Common Type System (CTS).
What is "Common Language Specification" (CLS)?
CLS is the collection of the rules and constraints that
every language (that seeks to achieve .NET
compatibility) must follow. It is a subsection of CTS
and it specifies how it shares and extends one another
What is "Common Language Runtime" (CLR)?
CLR is .NET equivalent of Java Virtual Machine (JVM). It
is the runtime that converts a MSIL code into the host
machine language code, which is then executed
appropriately. The CLR is the execution engine for .NET
Framework applications. It provides a number of
- Code management (loading and execution)
- Application memory isolation
- Verification of type safety
- Conversion of IL to native code.
- Access to metadata (enhanced type information)
- Managing memory for managed objects
- Enforcement of code access security
- Exception handling, including cross-language
- Interoperation between managed code, COM objects, and
pre-existing DLL's (unmanaged code and data)
- Automation of object layout
- Support for developer services (profiling, debugging,
and so on).
Page Numbers :