Configuring Projects Using postsharp.config

You can configure PostSharp by putting an XML file named postsharp.config in your project directory or in any parent directory.
This configuration file can also be named <YourProject>.psproj or <YourProject>.pssln
as we will describe here below.

PostSharp will automatically load a few well-known configuration files if they are present on the file system,
in the following order:

Any file named postsharp.config located in the directory containing the MSBuild project
file (csproj or vbproj, typically), or in any parent directory, up to the
root. These files are loaded in ascending order, i.e. up from the root directory to the project directory.
This is the recommended way to configure new projects.

Any file named <MySolution>.pssln located in the same directory as the solution file
<MySolution>.pssln. Also PostSharp Tools for Visual Studio uses this file for convenience,
we recommend you do not use this file and move the configuration to a shared postsharp.config
file instead. The reason is that a project file can belong to several solutions, and it would be misleading
to have the compilation depend on which solution was used.

Any file named <MyProject>.psproj located in the same directory as the project file
<MyProject>.csproj or <MyProject>.vbproj.

For instance, the files may be loaded in the following order:

c:\src\BlueGray\postsharp.config

c:\src\BlueGray\FrontEnd\postsharp.config

c:\src\BlueGray\FrontEnd\BlueGray.FrontEnd.Web\postsharp.config

c:\src\BlueGray\Solutions\BlueGray.pssln assuming that the current solution file
is c:\src\BlueGray\Solutions\BlueGray.sln.

c:\src\BlueGray\FrontEnd\BlueGray.FrontEnd.Web\BlueGray.FrontEnd.Web.psproj assuming that
the current project file is c:\src\BlueGray\Solutions\BlueGray.sln.

Sharing configuration between projects

The most typical way to share configuration between projects is to have a postsharp.config file
in a parent directory of all projects.