In a project created by Visual Studio, a file called"Assemblyinfo. CS", Which describes the Assembly generated by the project, will be also automatically created. and it's very common that there is more than one project in a solution. therefore, there will be replaced "assemblyinfo. CS "existing in a solution. however, the contents of these "assemblyinfo. CS "are more or less the same. it's a type of duplication for sure. we 'd better extract all the duplicated code into a global file shared by all the projects.
The image describes the scenario: In a solution, there is a global file called"Globalassemblyinfo. CS"Which describes assemblies generated by all the projects, and every project holds a reference to the Global File.
Steps:
- Create a file called "globalassemblyinfo. cs ";
- Add the file to the solution as a solution item;
- Open the Global File, Write appropriate codes in it.Sample:
1 using system;
2 using system. reflection;
3 using system. runtime. interopservices;
4
5 [Assembly: comvisible (false)]
6 [Assembly: clscompliant (true)]
7 [Assembly: assemblyproduct (".")]
8 [Assembly: assemblycompany ("company name")]
9 [Assembly: assemblyversion ("1.0.0.0")]
10 # If debug
11 [Assembly: assemblyconfiguration ("debug")]
12 # else
13 [Assembly: assemblyconfiguration ("release")]
14 # endif
15 [Assembly: assemblycopyright ("")]
16 [Assembly: assemblytrademark ("")]
17 [Assembly: assemblyculture ("")]
- Open a project file (. csproj, etc.) in a text editor, append the following section to<Files>/<include>Element.1 <File
2 relpath = "globalassemblyinfo. cs"
3 link = ".. \ common \ globalassemblyinfo. cs"
4 subtype = "code"
5 buildaction = "compile"
6/>