My question is pretty basic: What is the AssemblyInfo.cs
file used for?

- 8,607
- 10
- 51
- 71

- 45,256
- 81
- 201
- 304
-
But remember this version number is used along with name, public key token and culture information only if the assemblies are strong-named signed. If assemblies are not strong-named signed, only file names are used for loading. – Karl SoCal Sep 02 '16 at 18:46
6 Answers
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
-
1So, if I never change the version number in my AssemblyInfo file then no matter how many deployments I perform it will always show as 1.0.0.0? – Sachin Kainth Nov 01 '12 at 16:01
-
3What if I want to automate update of version every release. Is this possible? – Sachin Kainth Nov 01 '12 at 16:02
-
After successfull build in project settings, you can call some .exe to update this number (so it will be the version number for next release, not the one just built). Have a look at: http://www.codeproject.com/Articles/31236/How-To-Update-Assembly-Version-Number-Automaticall – Francois Nov 01 '12 at 16:07
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

- 9,564
- 146
- 81
- 122

- 168,305
- 31
- 280
- 331
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.

- 43,130
- 20
- 110
- 148
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.

- 3,865
- 9
- 51
- 76

- 7,355
- 7
- 43
- 56
It is a convenient location for assembly level attributes, such as the version, company name etc.

- 489,969
- 99
- 883
- 1,009
AssemblyInfo.cs contains general information about the application you are building, some of these information includes the title of your application, copyright etc, for instance if the title of your application is "MyApplication" you should see something like this: [assembly: AssemblyTitle("MyApplication")]

- 1,305
- 1
- 12
- 36

- 21
- 4
-
5Welcome to Stack Overflow. It's nice to see you involved but please avoid adding answers which don't bring anything new to the topic. – machnic Feb 22 '19 at 08:39