What is AssemblyInfo.cs used for?

后端 未结 6 924
北恋
北恋 2020-12-23 09:06

My question is pretty basic. What I\'d like to know is what is the AssemblyInfo.cs file used for?

6条回答
  •  滥情空心
    2020-12-23 09:10

    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.

提交回复
热议问题