I'm developing a class library which should be licensed to specific developer computers. There are no components so that the design time licensing checks can't be done.
This check is in fact unavailable for pure class libraries:
if( LicenseContext.UsageMode == LicenseUsageMode.Designtime ) ...
One has suggested to use Debugger.IsAttached to check if the lib is used on the developer machine: Design-Time validation of library
But I'm looking after a solution on the build stage, so that the program won't build if the license is invalid (e.G. this machine is not licensed). Any suggestions?
Right-click on the solution in Solution Explorer and select Add > New Project. On the Add a new project page, enter library in the search box. Choose C# or Visual Basic from the Language list, and then choose All platforms from the Platform list. Choose the Class Library template, and then choose Next.
I think it is impossible or very hard to do license check in compile / build time. It is hard for you to force something to happen (like license check) in build time.
For licensing take a look at Rhino Licensing. Maybe you can make an obfuscated version without license check, and an normal version with a license check.
But any license protection can be hacked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With