How to improve the Windows Phone 7 Licensing development experience?

Microsoft really helps developers to implement licensing for your application. First of all everyone has probably read: “an app can only be installed through the Marketplace”. But beside this installation, an application can be tried through the Marketplace. The developer doesn’t have to write complex licensing mechanisms based on RPN strings. If you want to have limited features when the app is in Trial, it’s just one small piece of code. First reference the correct library.

Add Reference to Microsoft.Phone.License

The the code is really simple.

LicenseInfo licenseInfo = new LicenseInfo();
    //Limit the application in some way

Yes that’s all. But how does this code behave? As far as I’ve understood so far, in the final version the IsTrial will check the license with the Marketplace. Right now the behavior is just returning “true”, so that doesn’t help our development, we can’t influence this result in any documented way right now. So I was thinking about possible solution, and remember the Conditional Compilation Symbols.

Step 1: Create a New Solution Configuration

New Solution Configuration

Make sure that you use Copy settings from “Debug” and “Create new project configurations”.

Step 2: Change Project Properties

Add a Conditional Compilation Symbol, for example: “FULL_VERSION”

Project Properties with Conditional Compilation Symbol

Step 3: Use this Compilation Symbol

LicenseInfo licenseInfo = new LicenseInfo();
#if FULL_Version
if (false)
    //Full Version so this code is not executed.
    //Trial Version

Step 4: Switch between different trial and full version

You can now switch from trial (Debug) to full (Debug Full Version) and back again using the Solution Configuration Selector

Solution Configuration Selector

Hope this helps people who want to develop trial and full versions of their apps.