Monday, May 21, 2007

.NET Deployment Questions

What do you know about .NET assemblies?
Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET Remoting applications.

What is the difference between private and shared assembly?
Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.

What is strong name?
A strong name includes the name of the assembly, version number, culture identity, and a public key token.

How can you create a strong name for a .NET assembly?
With the help of Strong Name tool (sn.exe).

How can you tell the application to look for assemblies at the locations other than its own install?
Use the directive in the XML .config file for a given application.

Should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

How can you debug failed assembly binds?
Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.

Where are shared assemblies stored?
Global Assembly Cache.

Where is the global assembly cache located on the system?
Usually C:\winnt\assembly or C:\windows\assembly.

Can you have two files with the same fine name in GAC?
Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0.

So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll?
Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.

What is delay signing?
Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development

Difference between namespace and assembly?
Assembly will contain Namespaces, Classes, Data types it's a small unit of code for deployment.Namespace is used in order to avoid conflict of user-defined classes

Namespace:
· It is a Collection of names wherein each name is Unique.
· They form the logical boundary for a Group of classes.
· Namespace must be specified in Project-Properties.
Assembly:
· It is an Output Unit.
· It is a unit of Deployment & a unit of versioning.
· Assemblies contain MSIL code.
· Assemblies are Self-Describing. [e.g. metadata, manifest]
· An assembly is the primary building block of a .NET Framework application.
· It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files).
· All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.

Difference between Namespace, Assembly, and Base classes?
1. A namespace is a collection of different classes.
2. An Assembly is a complied and versioned collection of code and metadata that forms an atomic functional unit. Assemblies take the form of a dynamic link library (.dll) file or executable program file (.exe) but they differ as they contain the information found in a type library and the information about everything else needed to use an application or component.An assembly includes:
a. Information for each public class or type used in the assembly – information includes class or type names, the classes from which an individual class is derived, etc
b. Information on all public methods in each class, like, the method name and return values (if any)
c. Information on every public parameter for each method like the parameter's name and type
d. Information on public enumerations including names and values
e. Information on the assembly version (each assembly has a specific version number)
f. Intermediate language code to execute
g. A list of types exposed by the assembly and list of other assemblies required by the assembly
3. The .NET Base Classes are the means by which you can access much of the core functionality of Windows, as well as perform operations such as data access from .NET code. It consists of a huge number of classes that Microsoft has written to carry out these operations, and which you can call in your code. You can even write classes that inherit from the base classes.

.NET FCL consists of series of classes, interfaces, and value types that can be used to program with. The .NET Framework has types that allow one to easily:
· Create extravagant graphical user interface applications (System.Windows.Forms)
· Access and manipulate data in various database formats (System.Data and System.Xml)
· Dynamically query type information (System.Reflection)
· Perform basic Input/Output operations (System.IO)
· Perform operating system security checks (System.Security)
· Create internet enabled applications (System.Net and System.Net.Sockets)
· Create dynamic web based application, ASP.NET (System.Web)
· Access basic data types, event handlers, and exceptions (System)
All types in the FCL are Common Language Specification (CLS) Compliant.

No comments: