Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute method from referenced class library before build .NET application for license checking [closed]

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?

like image 462
Thomas Maierhofer Avatar asked Mar 17 '13 12:03

Thomas Maierhofer


People also ask

How do I run a class library in Visual Studio?

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.


1 Answers

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.

like image 197
pero Avatar answered Oct 05 '22 02:10

pero