| Severity | Error |
| Reported by | PostSharp |
| Message | <Reason> To register a license key, see https://doc.postsharp.net/deploying-keys. |
Cause
Every project that PostSharp builds requires a license, at least the free edition, PostSharp Essentials. Before it writes the output of the project, PostSharp checks that one of the licenses that the project and the machine supply covers PostSharp Essentials. PostSharp also checks the license of some features when the project uses them, for example a premium feature beyond the limit of PostSharp Essentials, or an aspect weaver plug-in.
PostSharp reports PS0242 when such a check fails and PostSharp found no usable license at all. <Reason> names the component that requires a license and the products that cover it, and ends with Could not find any valid registered license. When PostSharp found at least one usable license, which does not cover the component, it reports PS0127 instead.
PostSharp finds no usable license in the following cases:
- No license key is registered on the machine for the current user, and the project does not set one with the
PostSharpLicenseMSBuild property or environment variable, or with aLicenseelement of apostsharp.configfile. - Every license key that PostSharp found was rejected. PostSharp then reports the reason of each rejection in a separate message, before PS0242: PS0301 for an invalid key or a key for another product, PS0304 for an expired or revoked key, or PS0148 when a license server does not lease a license. A frequent case is a key whose subscription ended before the release of the version of PostSharp that the project uses.
- The license string of the project contains
clearornone, which tells PostSharp to ignore the license keys registered on the machine and the license of unattended builds, and the project supplies no valid key itself.
This message depends on the license of the machine and of the build, so no example can show it.
Resolution
- Register a license key, or set it in the project, as Deploying License Keys describes. PostSharp Essentials is free; see PostSharp Essentials.
- When PostSharp reports another licensing message before PS0242, fix the problem that this message describes: renew an expired subscription, copy a truncated key again, or use a version of PostSharp that was released before the end of your subscription.
- On a build server, set the license key with the
PostSharpLicenseenvironment variable or MSBuild property. See Using PostSharp on a Build Server. - When the license string contains
clearornone, add a valid license key to the same string, or removeclearandnoneso that PostSharp also reads the keys registered on the machine.
To see which keys PostSharp considers and why it rejects them, capture the licensing trace with the PostSharpTrace MSBuild property, as License Troubleshooting describes.
See Also
Other Resources
Deploying License Keys
PostSharp Essentials
License Troubleshooting
Using PostSharp on a Build Server