How to set licensekey to my project?

Dec 19, 2011 at 6:29 AM


I purchased document toolkit developer license.

And, I want to remove the documenttoolkit watermark.

I setted my project as follow.

1. download license,xml at received my email.

2. add license.xml to the root of my project.

3. add to InitializeComponent() of mainpage.xaml as below

           if (_contentLoaded) {
            _contentLoaded = true;
            FirstFloor.Documents.License.SetLicenseKey(new Uri("/LoadFromWeb;component/license.xml", UriKind.Relative));
            System.Windows.Application.LoadComponent(this, new System.Uri("/LoadFromWeb;component/MainPage.xaml", System.UriKind.Relative));
            this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
            this.DataSource = ((FirstFloor.Documents.Controls.DocumentDataSource)(this.FindName("DataSource")));
            this.Viewer = ((FirstFloor.Documents.Controls.DocumentViewer)(this.FindName("Viewer")));

4. Build my project.

But, when I load web page, occurs exception.

Exception Message is "/LoadFromWeb;component/license.xml" not found.

Please Help me.

Dec 19, 2011 at 10:50 AM
Edited Dec 19, 2011 at 10:51 AM

Did you set the build action for the License.xml file to Resource?

- Koen

Jan 14, 2012 at 5:12 AM

THis works like a charm. Drag the license.xml file into your silverlight project (into the root) so that you see the icon with a little globe image... if it's not, right click it, and say include in project. Then put this line somewhere in the page load or initialization method.

 FirstFloor.Documents.License.SetLicenseKey(New Uri("License.xml", UriKind.Relative))

Boom, your done.