On the 26th the great folks at SharpCrafters announced the much anticipated PostSharp 3 CTP (Community Technical Preview). There are many changes in this CTP so lets review some of them.
For anyone new let me start by a quick explanation of what PostSharp is:
PostSharp is an Aspect-Oriented programming (AOP) framework for the .NET platform. PostSharp conducts a type of AOP called “static weaving” through a post compiler. This allows developers eliminate their cross-cutting concerns from cluttering up their source code.
Installation
No more standalone installer. Installation can not be conducted two ways:
- Visual Studio Gallery: This is in my opinion a great new feature. I personally like PostSharp as an extension then a NuGet package. On top of that it will gain the advantage of auto updates.
- NuGet: (Ensure prerelease is enabled): This was added in PostSharp 2.1, and will continue to be an installation option.
New Features
- Support for Visual Studio 2012 has been added.
In the official announcement they show the light theme, in their normal coding thoroughness they also support the dark theme (which is what I will be showing off).
- Smart Tags:
In PostSharp 2.1 they introduced the Postsharp Toolkit. This was a way for them to provide customers with prebuilt already made Aspects that are commonly used. Some examples are logging, threading, and INotifyPropertyChanged.
The complicated side of it was that you had to install them via NuGet, then add the aspect to the class you wanted to apply it to. Well with smart tags it just got easier. Just by moving your mouse over the class, the smart tag icon appears (so far no conflict with ReSharper nor JustCode in my environments). Then simply select the option you want. If the we say select ‘Add logging’ PostSharp will check if the logging toolkit exist, if not it will download the NuGet package and apply the aspect to the class for us.
- Step through Wizards
Lets look at the example of the suggested above and select the logging smart tag, we are presented with this screen:
From here we are free to select which methods to target, Logging level, even the type of logging that should be conducted.
- Support for Windows Store Apps, Silverlight, and Windows Phone
Well I needed a reason to write a few XAML/C# windows store applications, well now I found it. Since version 1.5, PostSharp worked in a limited capacity with Silverlight and Windows Phone, that limitation has been lifted.
- Portable Class Libraries support
A portal class library are great if you have an application that can target multiple platforms (.NET 4.x, Silverlight, Windows Phone, so on…). Before this support you would have to create a dll for each platform… not anymore.
- Licensing Changes
With PostSharp 3, the license will be moved to a 1 year of free updates and support support and assistance. Offical pricing has not been announced but will be shortly.
For more detail please visit SharpCrafters offical announcement.