|
Diff. between .EXE and .DLL
.EXE .DLL
Stand alone Dependent, it can’t work by itself. It will work with any other executable files.
Have its own memory space Don’t have any own memory space, it utilize the executable files memory space when ever it required.
GAC (Global Assembly Cache)
GAC is used where shared .NET assembly reside GAC.
If the application has to be shared among several application.
If the assembly has some special security requirements like only administrators can remove the assembly. If the assembly is private then a simple delete will remove the assembly.
Strong Name
Strong Name is needed when we deploy assembly in GAC. Strong Name helps GAC to differentiate between two versions. It will use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept.
In command prompt type sn.exe “c:\test.snk”.
After generation of the file you can view the SNK file in a simple notepad.
After the SNK file is generated its time to sign the project with the SNK file.
Click on project – properties and the browser the SNK fie to the respective folder and compile the folder.
How to view an Assembly (or) ILDASM.
ILDASM basically converts the whole exe or dll into IL code. To run ILDASM you have to go to “C:\ProgramFiles\Microsoft Visual Studio.NET 2003\SDK\v1.1\Bin”.
If you run ILDASM.EXE from the path you will be popped with the IDASM.exe program.
Click on file and browse to the respective directory for the DLL whose assembly you want to view. After you select the DLL you will be popped with a tree view details of the DLL.
On double clicking on manifest we will be able to view details of assembly, internal IL code etc.
Namespace
Collection of classes, used to categorize the classes, uses to avoid the conflict between two classes in the same name.
The root of the .NET Framework is the systemnamespace.
We can use aliases for namespace.
Imports A (aliases name) = <application.name>.root.mynamespace
How to implement?
We want to create a instance of that particular classes (or) objects.
Namespace and Assembly
Assembly Namespace
Physical grouping of logical units Logically grouping classes, can span multiple assembly
Hai this is Prabahar, working as a Software Engineer, in .NET Plateform for more than 3 years.
|
|
|
|
|
NET Framework
.NET Framework is a managed, type safe environment for application development and execution.
It manages all aspects of the execution of your program.
It allocates memory for the storage of data and instructions, grants and denies the permissions to your application, initiates and manages application execution, and manages the reallocation of memory, which is no longer needed.
Consist of two main components:
Common Language Runtime.
Environment, which manages the code execution.
It provides core services, such as code compilation, memory allocation; thread management, reflection functionality, garbage collection as well as other functions.
.NET Framework Class Library.
Provides a collection of useful and reusable types that are designed to integrate with the CLR.
Types provided by the .NET Framework are object-oriented and fully extensible, and allow us to integrate our application with the .NET Framework.
MSIL (Microsoft Intermediate Language)
All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
METADATA
When a compiler produces MSIL, it also produces metadata, which describes the types in your code.
It includes the definition of each type, the signatures of each type members, the members that your code references and other data that the runtime uses at execution time.
Information about source code.
Manifest
Assembly metadata is stored in manifest, It contains all the metadata needed to do the following:
Version of Assembly
Security identity
Scope of the assembly
Resolve references to resources and classes.
Assembly manifest can be stored in either a PE file (an .exe or .dll) with MSIL code or in stand-alone PE file that contains only assembly manifest information.
Common Language Runtime (CLR)
CLR is the execution engine (or) the heart of .NET Framework applications. It provides a number of services, including the following:
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 exceptions.
Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data) and Automation of object layout.
Support for developer services (profiling, debugging, and so on).
Common Type System (CTS)
CTS ensure type compatibility between .NET components.
.NET applications are converted to IL to deployment and execution, all primitive data types are represented as .NET types.
In order that two languages communicate smoothly CLR has CTS.
Example: in VB you have “Integer” and in C++ you have “long” these data types are not compatible. So the interfacing between them is very complicated. To communicate two languages Microsoft introduced CTS. So”Integer” data type in VB6 and “int” data type in C++ will convert it to System.in32 which is a data type of CTS.
Because both languages use a common and interconvert able type system, it is possible to transfer data between components and avoid time-consuming conversions.
Common Language Specification (CLS)
It is a subset of CTS which all .NET languages are expected to support.
Ensures that any source code compiled by a .NET compiler can interoperate with the .NET Framework.
Managed Code and Unmanaged Code
The code executing under the control of the CLR.
It supplies metadata necessary for the runtime to provide services such as memory management, cross language integration, code access security and automatic life time control objects.
Unmanaged code which runs outside the CLR.
Assembly
Is a primary unit of .NET Framework, it is an independent one.
Is a unit of deployment like EXE or a DLL, and consists of one or more files (dlls, exe’s html files etc.), and represents a group of resources, type definitions and implementations of those types.
It may also contain references for other assemblies.
These resources, types and references are described in a block of data called manifest, it is a part of the assembly.
It contains metadata information which used by the CLR for everything from type checking and security to actually invoking the components methods.
Types of assemblies
3 types of assemblies are Private, Public/shared and Satellite Assemblies.
Private Assemblies: is used by a single application and stored in the application directory or sub-directory.
Public/shared Assemblies: which can be shared across the applications is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).
Satellite Assemblies: These assemblies contain resource files like (Culture+Language). These assemblies are used in deploying a Global application for different languages.
Hai this is Prabahar, working as a Software Engineer, in .NET Plateform for more than 3 years.
|
|
|
|