Assembly Information in VB.NET

Assembly attributes are the properties of an assembly that gives information such as company name, product, copyright, version, culture and other information about an assembly.
  • 3680

Assembly Information

Assembly attributes are the properties of an assembly that gives information such as company name, product, copyright, version, culture and other information about an assembly. To learn about an assembly, right click on an executable, select Properties menu item and then select Details tab, you will see information about file type, version, product name and version, company information and so on as you can see in Figure 3. 

 

AI1.jpg
 

Figure 3

When you create a Windows Forms application using Visual Studio 2010, this information is automatically created for you. But this is not a secret. You can change this information in your application in AssemblyInfo.cs class.

If you open your project in Visual Studio 2010 and view project files on Solution Explorer, you will not see AssemblyInfo.cs class. To find this file, you need to click on Show All Files icon in Solution Explorer as you can see in Figure 4.

 

Ai2.jpg
 

Figure 4

You may change an assembly information by changing assembly attributes in AssemblyInfo.cs class. If you double click on AssemblyInfo.cs class, you will see something like Figure 5 where you can see you can change value of title, description, company, product, copyright and other culture information.

 

AI3.jpg
 

Figure 5

This information can be accessed in code by using the Application class properties. The C# code snippet in Listing 5 displays CompanyName, ProductName, and ProductVersion properties of an application in a ListBox control.

listBox1.Items.Add("CompanyName: " + Application.CompanyName);

listBox1.Items.Add("CommonAppDataRegistry: " + Application.ProductName);

listBox1.Items.Add("ExecutablePath: " + Application.ProductVersion);

 

Listing 5

The output of Listing 5 looks like Figure 6.

 

AI4.jpg
 

Figure 6

Listing 6 is the VB.NET version of Listing 5.

listBox1.Items.Add("CompanyName: " + Application.CompanyName)

listBox1.Items.Add("CommonAppDataRegistry: " + Application.ProductName)

listBox1.Items.Add("ExecutablePath: " + Application.ProductVersion)

 

Listing 6


 

Stay tuned until next article!


 


  

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.