Click here to Skip to main content
15,904,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have developed a .NET DLL using Visual studio 2015 targeted to .NET framework 4.0 . 
This DLL can be used in Winform, WPF and Web applications.
We need to implement licensing functionality for Design time and runtime .
Could you please suggest the best way to do taht .

Note: This is just a .NET dll NOT a componet 


What I have tried:

I have tried if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)

It does not work
Posted
Updated 16-Nov-17 2:42am
v2

1 solution

LicenseManager.UsageMode DOES work, but that's not what it's for.

Try this:

C#
System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess();
bool res = process.ProcessName.ToUpper().Contains("VSHOST");
process.Dispose();


Caveat: I don't think this will work for web apps, but I'm not really a web developer, so I have no real interest in finding out.
 
Share this answer
 
v2
Comments
P.Gnanaraj 16-Jan-18 7:39am    
The above code will get execute when the application runs...But I need the code should get executed during design time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900