Share a globalassemblyinfo. CS among projects in a solution

Source: Internet
Author: User

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/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.