Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is AssemblyInfo.cs used for?

Tags:

.net

People also ask

Where do I put AssemblyInfo CS?

Thanks. AssemblyInfo. cs file is created automattically when you create a windows application by Microsoft Visual Studio 2005. It is located under the folder "Properties".

What are the attributes of AssemblyInfo CS file?

Assembly identity attributes Three attributes (with a strong name, if applicable) determine the identity of an assembly: name, version, and culture. These attributes form the full name of the assembly and are required when you reference it in code. You can set an assembly's version and culture using attributes.

How do I add AssemblyInfo file to CS?

You can generate an assemblyInfo. cs by right clicking the project and chosing properties. In the application tab fill in the details and press save, this will generate the assemblyInfo. cs file for you.

What is AssemblyInfo VB file?

AssemblyInfo. vb file is created for every project. By default it is not displayed in the Solution/Project Explorer. To view this file and others in Visual Studio click Project >> Show All Files menu items.


AssemblyInfo.cs contains information about your assembly, like name, description, version, etc. You can find more details about its content reading the comments that are included in it.

If you delete it, your assembly will be compiled with no information, i.e., in the Details tab of the file properties you will see no name, no description, version 0.0.0.0, etc.

The value associated with assembly:Guid is the ID that will identify the assembly if it will be exposed as a COM object. So, if your assembly isn't COM-exposed, you don't need this. It is randomly generate. In any case, normally, you don't need to modify it.

Credits goes to : http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/8955449f-71ac-448e-9ee6-5329fceecd3c


In AssemblyInfo file Informational Attributes contains the information about product Name, description, Trademark, copyright. In general this information's are either hardcode or store in database or flat file. .NET assembly provides to store this information in AssemblyInfo file and after compilation it becomes the part of assembly. So at run time one can read this information.

Part of Assembly Information

1 AssemblyTitle : Title name from the assembly.

2 AssemblyDescription: It provides the detail description from the assembly.

3 AssemblyCompany: It Provides the company information from the assembly.

4 AssemblyProduct: It provides the production information from the assembly.

5 AssemblyCopyright: It Provides the copyright from the assembly.

6 AssemblyTrademark: It Provides the trademark from the assembly.

Each of these attributes has a defined class, which is used to read the information from the AssemblyInfo file.

From: https://www.dotnetspider.com/forum/157292-assemblyinfo-file.aspx


Go to your Project Properties, the Application tab, and click the Assembly Information button.

That's what is stored in AssemblyInfo.cs.

In Windows Explorer, right click your project's .exe output, select Properties, and go to the Details tab. That is the information generated by AssemblyInfo.cs.


In AssemblyInfo file you can store informations which you can get from every place in the project, so you don't have to update all the places but just the assemblyInfo.

For example - in this file you update the version number, and it is updated automatically in your site. In the html page, to get the version number, write:

Assembly assembly = Assembly.GetAssembly(typeof(ProjectName.WebSite.Controllers.MyController));
string version = assembly.GetName().Version.ToString();

and it will be updated each time you upload a new version.


It is a convenient location for assembly level attributes, such as the version, company name etc.