Aspose Words set license error when using it as part of plugin throws an error

We upgraded from 14.3 Tridion Docs to 15.1 and are running into an issue with setting Aspose license, as we updated our codebase to .Net 4.8 from .Net4.7.2 and updated Aspose to 24.0.1 we are getting the following when using Aspose in a publish plugin. We are unable to replicate this issue when using Aspose in command line script on the batch server, which ruled out it being an Aspose issue.

Fullscreen
1
EXCEPTION MESSAGE: Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. EXCEPTION MESSAGE: Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 EXCEPTION MESSAGE: Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. EXCEPTION MESSAGE: Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The plug-in looks like this

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public void Run(IPublishPostProcessContext context)
{
License license = new License();
try
{
var publishedHtmlDirectory = context.Items["DITAOTOutDirectory"].ToString(); // get html document
var publishedHtmlFile = $"{publishedHtmlDirectory}\\index.html";
var filetemp = new FileInfo(publishedHtmlFile);
var saveLocation = Path.ChangeExtension(publishedHtmlFile, ".docx"); // get save to location and file name
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // set license
\\fails at the line below
license.SetLicense(@"F:\InfoShare\App\Plugins\Aspose.Total.Net.lic");
var asposeHtml = new Document(publishedHtmlFile); // new up aspose document
asposeHtml.Save(saveLocation, SaveFormat.Docx); // save
}
catch (Exception exc)
{
_logService.ErrorException("File conversion service failed.", exc);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

emoji