ARTICLE

How to perform Assembly building in VB.NET

Posted by Manish Tewatia Articles | Visual Basic Language July 30, 2010
In this article I will show you the assembly building using VB.NET.
 
Reader Level:

HTML clipboard

For assembly building you have to use the .NET compiler and compiler having this four element which performed in assembly building.

  1. Friendly name

  2. Culture setting

  3. Version number

  4. Public key or public key token

Friendly name: you can use like MyAssembly.

Culture setting: This phase is all about the representation mean the culture setting shows the spoken language in which the assembly has localized.

Version number: It shows the version of assembly in which it was created and the version number shows in the four parts with . separation like 2.43.5.6 this four parts have own different meaning: it represents the major version, minor version, build number, and revision number, and this version number you should be declared at the time of assembly creation at the top of the project source files.

Syntax of declaration of version number

Import System.Reflection
<Assembly: AssemblyVersion ("major version.minor version.build number.revision number")>

If you not specify any version number the compiler per perform this task and then the version number will be 0.0.0.0 this is default version number.

Public key or public key token: Public key is represents your identification, ones you used a public key then the same public key is not used by any other person it is unique key. The public key is stored in key file as binary format a size of 128 bytes.

You can also write the public key by using a text based hexadecimal format as below:

1.gif

Figure 1

The public key is smaller in size only 8 byte value, So we used public key token at the place of public key it is almost same as public key the only difference is that the public key token is represented by a 16-character hexadecimal string value.

Get to Work of Assembly Building.

The first step of assembly building is to give a strong name to the assembly which get a pair of public-private key pair. The public key is written into the physical image of the assembly. The private key is used to generate digital signatures. The key is generated using the .NET framework strong name utility, SN.exe, by specifying the –k switch and the target key file from the command line.

SN.exe -K Keyfilename.snk

The next step is to add the following code at the top of one of the source files in a project:

Import System.Reflection
<Assembly:AssemblyVersion("2.0.45.1")>
<Assembly:AssemblyKeyFile("..\..\Keyfilename.snk")>

When you built the project, an assembly with a strong name is generated.

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • 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.
    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.
Nevron Diagram
Become a Sponsor