The updated CTP 4 (build 1009) contains two improvements that are good to know about.
1. Running PostSharp in an unattended session
Roy Osherove reported a problem when PostSharp 2.0 runs in a GUI-less build server. The cause of the issue was the tray icon of the pipe server. The new build will not attempt to open the tray icon if PostSharp detects that it runs in unattended mode.
PostSharp uses the property Environment.UserInteractive to determine whether the process is attended or not. If, for some reason, this detection gives unsuccessful, you can forbid the pipe server to open the tray icon by setting the following machine-level registry setting:
Windows 64-bit:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SharpCrafters\PostSharp 2.0] "TrayIconDisabled"=dword:00000001>
Windows 32-bit:
[HKEY_LOCAL_MACHINE\SOFTWARE\SharpCrafters\PostSharp 2.0] "TrayIconDisabled"=dword:00000001
2. Installing a license in the source control repository
PostSharp makes it very easy to deploy license keys: you can include it in your source control repository. First, paste the license key in a text file. Then, you need to tell PostSharp where the license key lies. This can be done by setting the MSBuild property named PostSharpLicenseFile to the full path of the license file.
One of the way of setting an MSBuild property is to edit the project file using a text editor and include the following before importing PostSharp targets:
<PropertyGroup>
<!-- There should probably be line break in the property -->
<PostSharpLicenseFile>
$(MSBuildProjectDirectory)\..\..\MyPath\PostSharp.license</PostSharpLicenseFile>
</PropertyGroup>
There are other ways to deploy the license key. For instance, you can put it on a network share and use group policies to set the PostSharpLicenseFile environment variable to the location on the share.
Note that sharing a license key is only legal if you have a company license key (Commercial License, Site License, Global License). Since other licenses (community and personal) are bound to a specific person, they cannot be shared.
3. Licensing of build servers
Build servers don’t need their own license. PostSharp will not attempt to enforce licensing if it detects that it runs in unattended mode. Again, it uses the property Environment.UserInteractive. The TrayIconDisabled registry setting has no effect on license check.
Now, this check does not work for any reason, you may use the license key of any licensed user for the build server. This will not be consider a license infringement.
As you can see, we try to make our licensing system as no-nonsense as possible. Our philosophy is that paying customers should not be handicapped by overly restrictive license enforcement. Something that not every software (or media) publisher understands…
Happy PostSharping!
-gael