Temporary license error

I am trying to apply temporary license to MVC Total demo project I am using the following code

using (FileStream fileStream = File.OpenRead(“GroupDocs.Totalfor.NET.lic”))
{
License license = new License();
license.SetLicense(fileStream);
}

I get this error

Error|CS0246|The type or namespace name ‘License’ could not be found (are you missing a using directive or an assembly reference?)|GroupDocs.Total.MVC

@nihaterdil

Thank you for reaching out. The issue you’re encountering is likely due to the missing namespaces for the specific GroupDocs APIs you’re trying to use. Each GroupDocs product (Viewer, Conversion, etc.) has its own License class, and you need to specify the appropriate namespace.

According to the public documentation, you should set the license for each GroupDocs product separately. Here is an example of how to do this:

string licensePath = "GroupDocs.Total.lic";
using (FileStream fileStream = File.OpenRead(licensePath))
{
    GroupDocs.Viewer.License licenseViewer = new GroupDocs.Viewer.License();
    licenseViewer.SetLicense(fileStream);

    GroupDocs.Conversion.License licenseConversion = new GroupDocs.Conversion.License();
    licenseConversion.SetLicense(fileStream);

    // Set licenses for other GroupDocs products you are going to use
}

Make sure to include the necessary using directives for the namespaces of the GroupDocs products you’re working with.

Please let us know if this works for you.