What is the Public Interface?
The Public Interface is the set of classes, interfaces and enumerations to which user assemblies are linked. We recommend to make a strict distinction between the Public Interface and the implementation classes and to package both sets of artifacts in separate assemblies, so that in no case user assemblies have to be linked to your implementation assembly.
The objective of packaging the Public Interface separately from the implementation are the following:
- It eliminates dependency problems: user assemblies will not
need at runtime libraries that are used solely during the
compilation process, like
PostSharp.Core.dll, your implementation code and eventually some legacy libraries. - It simplifies licensing: you can license the Public Interface and the implementation libraries under different licenses. It is perfectly possible to release your Public Interface to the public domain while publishing the implementation libraries under a more restrictive license. This way, you can avoid to propagate license constraints to user applications.
The PostSharp.Public assembly
The Public Interface of PostSharp Core is packaged in the
PostSharp.Public.dll library. Unlike other assemblies,
PostSharp.Public.dll is released to the public domain.
The Public Interface of specific plug-ins will typically depend on
this library.
With PostSharp.Public.dll, you can:
- using MulticastAttribute, define custom attributes that apply to more than one elements (class, method, type) using wildcards.
- using IRequirePostSharp, define custom attributes that are detected automatically by the default PostSharp build process (namely by the AutoDetectTask) and that can include the plug-in definition file and the task automatically, without the need to specify this requirement in the project file.
Freezing the Public Interface
Since user assemblies will be linked to the public interface, you should take care to design the Public Interface in such a way that you won't regret it in the future. Do not forget that you can neither delete, rename or change the characteristics of any public element (class, property, ...) once it has been deployed.