Introducing PostSharp to your team
Wednesday, September 16th, 2009PostSharp is AOP (Aspect-Oriented-Programming) framework (http://www.postsharp.org/).
It transparently inserts itself in the build process and post-processes the compiled assembly.
To enable PostSharp in your project you need to download and run the PostSharp installer, and add appropriate references in your project.
However if your project is in SVN, and you are not the only one compiling it (other developers, CI machine) most likely you don’t want to run PostSharp installer on all the machines.
There is a way to introduce PostSharp transparently to your project.
- Put all the PostSharp files in the \Lib\PostSharp folder of your project and add this folder to SVN.
-
Modify the .csproj file:
After the last ItemGroup following xml must be inserted:<PropertyGroup> <DontImportPostSharp>True</DontImportPostSharp> </PropertyGroup> -
Modify the .csproj file:
After the<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
following xml must be inserted:
<Import Project="..\Lib\PostSharp\PostSharp.targets" />
The whole change should be similar to this sample:
</ItemGroup> <PropertyGroup> <DontImportPostSharp>True</DontImportPostSharp> </PropertyGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\Lib\PostSharp\PostSharp-1.5.targets" /> </Project>
