views:

152

answers:

1

Is is possible to get postsharp to remove references to the postsharp assemblies during a build?

I have an exe i needs to have a very small footprint. I want to use some of the compile time weaving of postsharp but dont want to have to deploy PostSharp.dll with the exe.

I am using PostSharp 2 (2.0.4.1074 specifically)

A: 

As far as I know, this is impossible. References are necessary, since base classes of your aspects are located in public PostSharp assembly.

Alex Yakunin
but if postsharp does compile time waving to modify the assembly cant it modify the assembly to remove the references?
Simon
Alex is right. Note that aspects are executed at runtime, they are not inlined in your code. But you can use ILMerge to merge PostSharp.dll into one of your libraries.
Gael Fraiteur
Clear. References can't be removed, because to execute the aspects code, framework will need (in particular) all its base classes. These classes are in PostSharp.dll, so an attempt to remove the reference would lead to TypeLoadException (or similar) in runtime.
Alex Yakunin