Page 117 - CSharp/C#
P. 117
files and thus onto your assemblies.
The GitVersionTask or SemVer.Git.Fody NuGet packages are examples of the above. To use
GitVersionTask, for instance, after installing the package in your project remove the
Assembly*Version attributes from your AssemblyInfo.cs files. This puts GitVersionTask in charge of
versioning your assemblies.
Note that Semantic Versioning is increasingly the de facto standard so these methods recommend
using source control tags that follow SemVer.
Common fields
It's good practice to complete your AssemblyInfo's default fields. The information may be picked
up by installers and will then appear when using Programs and Features (Windows 10) to uninstall
or change a program.
The minimum should be:
• AssemblyTitle - usually the namespace, i.e. MyCompany.MySolution.MyProject
• AssemblyCompany - the legal entities full name
• AssemblyProduct - marketing may have a view here
• AssemblyCopyright - keep it up to date as it looks scruffy otherwise
'AssemblyTitle' becomes the 'File description' when examining the DLL's Properties Details tab.
[AssemblyConfiguration]
AssemblyConfiguration: The AssemblyConfiguration attribute must have the configuration that was
used to build the assembly. Use conditional compilation to properly include different assembly
configurations. Use the block similar to the example below. Add as many different configurations
as you commonly use.
#if (DEBUG)
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[InternalsVisibleTo]
If you want to make internal classes or functions of an assembly accessable from another
assembly you declare this by InternalsVisibleTo and the assembly name that is allowed to access.
In this example code in the assembly MyAssembly.UnitTests is allowed to call internal elements
from MyAssembly.
https://riptutorial.com/ 63

