Reputation: 46770
My question is pretty basic: What is the AssemblyInfo.cs
file used for?
Upvotes: 155
Views: 134493
Reputation: 172628
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
Upvotes: 16
Reputation: 21
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")]
Upvotes: 1
Reputation: 7569
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.
Upvotes: 11
Reputation: 10978
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
Upvotes: 102
Reputation: 44374
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.
Upvotes: 14
Reputation: 499382
It is a convenient location for assembly level attributes, such as the version, company name etc.
Upvotes: 4