So, it took me forever today to figure out how to get
PostSharp working without installing it 'globally' with the msi installer.
In a nutshell, you have to include a directory for example
/lib/ with all of the PostSharp baggage:
- Default.psproj
- PostSharp.targets
- PostSharp-1.0.targets
- PostSharp-1.0.version
- PostSharp-AppDomain.config
- PostSharp-Platform.config
- PostSharp.Core.dll
- PostSharp.Core.pdb*
- PostSharp.Core.XmlSerializers.dll
- PostSharp.exe
- PostSharp.exe.config
- PostSharp.pdb*
- PostSharp.Laos.dll
- PostSharp.Laos.pdb*
- PostSharp.Laos.psplugin
- PostSharp.Laos.Weaver.dll
- PostSharp.Laos.Weaver.pdb*
- PostSharp.MSBuild.dll
- PostSharp.MSBuild.pdb*
- PostSharp.Public.dll
- PostSharp.Public.pdb*
* = Optional
Add a reference to the PostSharp.Laos and PostSharp.Public assemblies in your project.
Then you have to edit your .csproj file around the existing <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> section to be:
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
<PostSharpDirectory>lib\</PostSharpDirectory>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(PostSharpDirectory)PostSharp.targets" />
You can download a working demo: http://rapidshare.com/files/183439996/PostSharpTest.zip.html