Wednesday 16 July 2014

what is .pdb file in .net?


A program database (PDB) file holds debugging and project state information that allows incremental linking of a debug configuration of your program. A PDB file is created when you build with /debug. You can build applications with /debug: full or /debug: pdbonly. Building with /debug: full generates debuggable code. Building with /debug: pdbonly generates PDBs but does not generate the DebuggableAttribute that tells the JIT compiler that debug information is available. Use /debug: pdbonly if you want to generate PDBs for a release build that you do not want to be debuggable.

What are the attributes of a strong name?



A strongly named assembly consists of four attributes that uniquely identify the assembly: a file name (without an extension), a version number, a culture identity, and a public key. Since public keys are very large numbers, we frequently use a small hash value derived from a public key. This hash value is called a public key token.

Example:

"MyDll, Version=1.0.8143.0, Culture=neutral, PublicKeyToken=b77a5c561934e078"

"MyDll, Version=1.0.8143.0, Culture="en-US", PublicKeyToken=b77a5c561934e078"

"MyDll, Version=2.0.1264.0, Culture=neutral, PublicKeyToken=b77a5c561934e078"

"MyDll, Version=1.0.8143.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a35"


What is the use of SN.exe?

SN.exe is used to generate public/private key pair.

Example:

SN –k MyKey.snk


The above line tells SN.exe to create a file called MyKey.snk. This file will contain the public and private key numbers persisted in a binary format.

Output:

Microsoft (R) .NET Framework Strong Name Utility Version 3.5.21022.8

Copyright (c) Microsoft Corporation. All rights reserved.



Key pair written to MyKey.snk