This section is dedicated to those who want to extend the functionalities of the PostSharp core and of existing plug-in by writing their own program analysis and transformation extensions. A PostSharp plug-in is a piece of functionality that can be loaded by the PostSharp platform and is made available to users for inclusion into their projects. Whether your plugin is open-source, free of charge or not, is at your sole discretion. The broad license model of PostSharp allows virtually all kinds of uses.
Planning your project
As in any software development project, it is always good to start with an analysis. Well of course, if you just want to develop a plug-in for yourself you won't want to get bored with an analysis. But if you plan to distributed, even for free, we recommend to answer the following questions:
-
What shall the plug-in allow to do?
-
Who are the customers? Which knowledge of .NET do they have?
-
How shall the tasks be detected by PostSharp? Shall it use automatic detection based on custom attributes or shall it require an explicit inclusion from the project file?
-
How shall the plug-in be deployed?
-
How shall the plug-in be licensed? Will this license be contagious to user assemblies that are transformed by your plug-in?
Once you have answered these questions and all issues that are typical to common software development projects, you can start designing the object, packaging and deployment models of your plug-in.
Implementing the plug-in
The implementation of a PostSharp plug-in typically includes the following activities:
-
Defining the Public Interface - The public interface contains the classes to which user assemblies are linked. The public interface is typically contained in a separate assembly than the implementation for the sake of limiting license contagion and dependencies to compile-time libraries.
-
Implementing the Analysis and Transformation Logic - The biggest task is usually to implement the logic that is executed inside the PostSharp platform at post-compilation time.
-
Writing the Plug-In Configuration File - This configuration file tells PostSharp which classes implement individual tasks and what are their dependencies.
-
Authoring the Installation Package - If you want to distribute your plug-in, you should package it conveniently. Common packaging methods include ZIP files of Microsoft Installer (MSI) packages.
Publishing Your Work
If you wish, we can publish your plug-in on the PostSharp web site and announce it availability using our communication channels.