Skip to main content

Posts

Showing posts from November, 2008

Hello, PostCompiler World!

Sometimes doing the simplest things is difficult. In order to make any headway on SharpMock, I’ll need to be able to understand the basics of PostSharp. What could be more basic than getting PostSharp to execute a task that ouputs a ‘Hello World’ message during the postcompilation process? We’re not decorating any types with attributes; we’re not intercepting any calls; we’re not outputting any IL. This should be a snap! And yet, I haven’t posted in weeks…. First thing’s first – we need a ‘Hello World’ task. In a project called PostSharpPlugin I have defined the following class: using PostSharp.Extensibility; namespace PostSharpPlugin { public class SayHelloTask : Task { public override bool Execute() { Console.WriteLine( "Hello, PostCompiler!" ); // Task executed successfully return true ; } } } I have also created a .psplugin file that looks like this: <? xml version ="1.0" ...