New Message on dotNET User Group Hyd

Article : License Compiler ( Lc.exe .Net FrameWork Tools )

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: Nasha

Hey Group,

We create a lot of coontrols every day but generally we never bother about licensing them. Licensing only comes into the picture when we need to share our controls with others.

Let us today create a licensed control then we will use lc.exe and embed the license in our assembly.

1) Open a new peoject Windows Control Library.

2) Add a new control to it. Could be inheriting from control or usercontrol.

3) There are a few thing that we need to do to make our licensed component.

4) Add LicenseProvider Class attribute giving the type of license provider we are using. LicFileLicenseProvider comes with the .Net Framework.

[LicenseProvider(typeof(LicFileLicenseProvider))]

5) Add a private license object to our class

private License license;

6) Validate the license in our constructor

license = LicenseManager.Validate(typeof(Ctrl1),this);

7) At last Dispose the license in the dispose method by overriding the dispose method.

if( disposing )

{

if(license == null)

{

license.Dispose();

license=null;

}

}

8) Your class should like this in the end

using System;

using System.Collections;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Windows.Forms;

namespace CL

{

[LicenseProvider(typeof(LicFileLicenseProvider))]

public class Ctrl : System.Windows.Forms.Control

{

private License license;

public Ctrl()

{

license = LicenseManager.Validate(typeof(UserControl1),this);

}

protected override void OnPaint(PaintEventArgs pe)

{

base.OnPaint(pe);

}

protected override void Dispose( bool disposing )

{

if( disposing )

{

if(license == null)

{

license.Dispose();

license=null;

}

}

base.Dispose( disposing );

}

}

}

9) Compile the project.

10) Create a new Windows application which will act as a host to our control. Name it LicCtrlClient.

11) Create a file called LicCtrlClientlic.txt which will hold the entire list of components and the dll name.

LicCtrlClientlic.txt contents

CL.Ctrl

CL.UserControl

CL.dll

12) Compile .licenses file for licCtrlClient

lc /target:licCtrlClient.exe /complist:LicCtrlClientlic.txt /i:CL.dll

13) <application.exe>.licenses file will be generated.

14) You can use your language compiler or al to embed this file in your exe.

 

-- Please post your queries and comments for my articles in the usergroup for the benefit of all. I hope this step from my end is helpful to all of us.

Regards,

Namratha (Nasha)

 

 

 


View other groups in this category.

Click here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to