Free Support Forum -

License and using in C# class

I am trying to use the Project component, and can’t figure out how to set the license. Here is my scenario:

I have an ASPX page that calls a method in a separate C# project/class that will then create my MPX file. I am not sure how to set the license on this component.

With the Excel component, I create an instance in the ASPX page setting the license in the constructor. I then pass the Excel object by ref to my class.

How do I do this with the Project component? Is there an easier way?


Hello Keith,

Thanks for you question.

It’s very simple to set license. You should add 2 lines in your code before using component.
In my case license file must be placed in “License” subdirectory.

// Set License
string licenseFile = MapPath(“License”) + “\Aspose.Project.lic”;
Project.SetLicense(licenseFile, this);

You can find this code in Aspose.Project.WF.MpxCreate example.
CreateProject.aspx.cs file (line 235).