Archive

Which package to download?

Since we provide five different packages, you may feel confused. Read on.

Windows Installer

If you want to install PostSharp globally and beneficiate from native images and help integration with Visual Studio, choose one of the Windows Installer (MSI) packages. We provide two versions: one for 32-bit operating systems, one for 64-bit (AMD64) operating systems. Note that these packages are built in release mode, which means that tracing and preconditions have been filtered out.

Binary Package

There are two good reasons to use a Binary Package:

  1. You can't install PostSharp globally because you don't have administrative rights.
  2. You plan to store PostSharp in your source repository, so you need its location to be relative to the working folder of the source repository.
  3. You want to develop against low-level APIes; therefore, you would like to beneficiate from the tracing facility and precondition checking that are absent from the release version.

In both last cases, we recommend you generate native images of assemblies PostSharp.exe, PostSharp.Core.XmlSerializers.dll and PostSharp.Laos.Weaver.dll using the ngen utility. You can use fuslogvw to check that native images are used.

There are two variants of the binary package:

  • Debug: Contains the tracing facility, the precondition checks, and is of course compiled in debug mode and comes with debugging symbols. Use this version if you plan to use the low-level APIes or if you are requested to do so in order to diagnose a bug.
  • Release: This version is recommended for common users of PostSharp.

Source Package

This package contains the source code (!). Download it if you want to know how it works.

The source code does not contain the private key. If you want to build the product on your own, you will need to provide your own keys and so some minor modifications in source code (replace our public key token by your).

Download

Download

{noreg}

You are not signed in. Most downloads are available only to registered users. Sign in now.

{/noreg}

Feeling brave? You can download a pre-release of PostSharp 2.0
Looking for an old version? See the archives

GUI Dispatch

Custom Attribute That Dispatches the Method to the GUI Thread

public class GuiThreadAttribute : OnMethodInvocationAspect
{
  public override void OnInvocation(MethodInvocationEventArgs eventArgs)
  {
    DispatcherObject dispatcherObject = (DispatcherObject)eventArgs.Delegate.Target;

    if (dispatcherObject.CheckAccess())
      eventArgs.Proceed();
    else
      dispatcherObject.Dispatcher.Invoke( DispatcherPriority.Normal,
                                          new
Action(() => eventArgs.Proceed()));
  }
}