How do I set the Aspose Words liense in Blazor WASM?
In Blazor Server, I have done it succesfully by putting my lic file in the root folder of the project and setting it as an embedded resource.
In Startup.cs, I create the License object and call SetLicense.
In a WASM project, I again put the lic file as an embedded resource in the project root folder.
I put the same line of code to call SetLicense in Program.cs, but when I debug the program, I get an error
System.ArgumentNullException: Value cannot be null. (Parameter ‘uriString’)
@TimDol Could you please share your code you use for setting the license and also stack trace of the exception?
You can try setting the license from stream, i.e. extract your embedded resource into a stream and pass this stream as a parameter to License.Setlicense method.
Could you please share your code you use for setting the license
What I was trying to do initially, was:
Put my .lic file in the project root folder and set the Build action to ‘Embedded resource’
In Program.cs, I had the following two lines of code
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(“Aspose.Words.NET.lic”);
Based on the feedback, I kept the .lic file as embedded resource, but changed the code to this:
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "<logical name set in .csproj file>";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
{
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(stream);
}