Composing Assemblies

You provide the compiler with your assembly information in an assembly information file (usually called in a C# project, AssemblyInfo.cs). The assembly information file is compiled with the rest of the project’s source files. The information in the file is in the form of assembly attributes directives to the compiler on the information to embed in the assembly. Example C-2 shows a typical set of assembly attributes.

Example C-2. The assembly information file includes a variety of assembly attributes

[assembly: AssemblyTitle("MyAssembly")]
[assembly: AssemblyDescription("Assembly containing demo .NET components")]
[assembly: AssemblyCompany("My Product")]
[assembly: AssemblyCopyright("(c) 2001 My Company ")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("en-US")]
[assembly: AssemblyVersion("1.0.*")]

Sharing Assemblies

Assemblies can be private or shared. A private assembly resides in the same directory of the application that uses it (or in its path). A shared assembly is in a known location, called the global assembly cache (GAC), mentioned in Chapter 10 Chapter 10. To add an assembly to the GAC, use either the .NET administration tool or the GACUtil command-line utility. Once in the GAC, the assembly can be accessed by multiple applications, both managed and unmanaged.

To avoid conflicts in the GAC between different assemblies that have the same name, a shared assembly must have a strong name. The strong name authenticates the assembly’s origin ...

Get COM & .NET Component Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.