什么是AssemblyInfo。cs用于?

时间:2022-08-28 03:11:10

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

我的问题很基本。我想知道的是什么是汇编信息。cs文件用于?

6 个解决方案

#1


60  

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.

AssemblyInfo。cs包含有关您的程序集的信息,如名称、描述、版本等。您可以找到更多关于它的内容的详细信息,阅读包含在其中的注释。

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.

如果你删除它,你的程序集将被编译,没有任何信息,例如。,在文件属性的Details选项卡中,您将看不到名称、描述、版本0.0.0.0.0.0等。

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.

与程序集关联的值:Guid是将程序集公开为COM对象的标识符。所以,如果你的程序集不是暴露的,你不需要这个。它是随机生成的。在任何情况下,通常不需要修改它。

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

学分转到:http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/8955449f-71ac-448e-9ee6-5329fceecd3c。

#2


13  

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.

3、装配公司:它提供来自装配的公司信息。

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

4汇编产品:提供来自汇编的生产信息。

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.

每个属性都有一个已定义的类,用于从assembly yinfo文件中读取信息。

Check out this link:- http://www.dotnetspider.com/forum/157292-assemblyinfo-file.aspx

查看这个链接:http://www.dotnetspider.com/forum/157292-assembly yinfo-file.aspx

#3


9  

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.

在Windows资源管理器中,右键单击项目的.exe输出,选择Properties,然后转到Details选项卡。这是汇编信息。cs生成的信息。

#4


7  

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 assemplyInfo.

在程序集信息文件中,你可以存储项目中每个地方的信息,所以你不必更新所有地方,只需更新汇编信息。

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:

例如,在这个文件中,你更新版本号,它在你的站点中自动更新。在html页面中,要获得版本号,请写:

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.

每次你上传一个新版本,它都会被更新。

#5


4  

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

它是组装层属性(如版本、公司名称等)的方便位置。

#6


0  

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.

但是请记住,只有当程序集具有强名称的签名时,这个版本号才能与名称、公钥标记和文化信息一起使用。如果程序集不是强名称签名的,则只使用文件名进行加载。

[https://support.microsoft.com/en-us/kb/556041]

[https://support.microsoft.com/en-us/kb/556041]

#1


60  

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.

AssemblyInfo。cs包含有关您的程序集的信息,如名称、描述、版本等。您可以找到更多关于它的内容的详细信息,阅读包含在其中的注释。

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.

如果你删除它,你的程序集将被编译,没有任何信息,例如。,在文件属性的Details选项卡中,您将看不到名称、描述、版本0.0.0.0.0.0等。

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.

与程序集关联的值:Guid是将程序集公开为COM对象的标识符。所以,如果你的程序集不是暴露的,你不需要这个。它是随机生成的。在任何情况下,通常不需要修改它。

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

学分转到:http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/8955449f-71ac-448e-9ee6-5329fceecd3c。

#2


13  

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.

3、装配公司:它提供来自装配的公司信息。

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

4汇编产品:提供来自汇编的生产信息。

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.

每个属性都有一个已定义的类,用于从assembly yinfo文件中读取信息。

Check out this link:- http://www.dotnetspider.com/forum/157292-assemblyinfo-file.aspx

查看这个链接:http://www.dotnetspider.com/forum/157292-assembly yinfo-file.aspx

#3


9  

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.

在Windows资源管理器中,右键单击项目的.exe输出,选择Properties,然后转到Details选项卡。这是汇编信息。cs生成的信息。

#4


7  

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 assemplyInfo.

在程序集信息文件中,你可以存储项目中每个地方的信息,所以你不必更新所有地方,只需更新汇编信息。

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:

例如,在这个文件中,你更新版本号,它在你的站点中自动更新。在html页面中,要获得版本号,请写:

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.

每次你上传一个新版本,它都会被更新。

#5


4  

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

它是组装层属性(如版本、公司名称等)的方便位置。

#6


0  

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.

但是请记住,只有当程序集具有强名称的签名时,这个版本号才能与名称、公钥标记和文化信息一起使用。如果程序集不是强名称签名的,则只使用文件名进行加载。

[https://support.microsoft.com/en-us/kb/556041]

[https://support.microsoft.com/en-us/kb/556041]