Information:
My MVC program will use Razor to generate an email template.
However, I found that the program does not work in Windows Server 2019.
It seems like the "Mvc.Razor.RazorViewEngine" cannot load the library under .net runtime. (I use DLLFinder64.exe to check and make sure the program loaded the library)
DLLFinder64 output
C:\share\DLLFinder>DLLFinder64.exe -f System.Drawing.Common.dll
Process Name PID DLL Name Base Address Load Count DLL Path
================================================================NexTore.WebApp.exe 7644 System.Drawing.Common.dll 0x00007FF8B32B0000 1 C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.16\System.Drawing.Common.dll
Workaround method:
Copy the missing libraries to my program's working directory
Error Log (the upload feature not working, no idea what happened. I share the log in below link)
https://drive.google.com/file/d/1L7ssUOCxUpZy66taKbC1wO9sFMETShkn/view?usp=sharing
Package Reference
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="4.1.0" />
<PackageReference Include="ClosedXML" Version="0.95.3" PrivateAssets="compile" />
<PackageReference Include="FastMember.NetCore" Version="1.1.0" PrivateAssets="compile" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.22" PrivateAssets="compile" />
<PackageReference Include="Hangfire.SqlServer" Version="1.7.22" PrivateAssets="compile" />
<PackageReference Include="Hangfire.Storage.MySql" Version="2.1.0-beta" />
<PackageReference Include="MimeTypeMapOfficial" Version="1.0.14" />
<PackageReference Include="iTextSharp" Version="5.5.13.1" PrivateAssets="compile" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00014" PrivateAssets="compile" />
<PackageReference Include="Lucene.Net.ICU" Version="4.8.0-beta00014" PrivateAssets="compile" />
<PackageReference Include="Lucene.Net.QueryParser" Version="4.8.0-beta00014" PrivateAssets="compile" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.7" PrivateAssets="compile" />
<!-- https://github.com/dotnet/aspnetcore/issues/7223#issuecomment-460278162
razor compilation package adds refs folder in module's output folder, PrivateAssets prevents it -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.7.0" PrivateAssets="compile" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.6" PrivateAssets="compile" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" PrivateAssets="compile" />
<PackageReference Include="MySqlConnector.Authentication.Ed25519" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.13" />
<PackageReference Include="NexTore.OptimaJet.Workflow.MySQL" Version="4.1.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.2" />
<PackageReference Include="UnityAddon.Cache" Version="2.6.5.1313" />
<PackageReference Include="UnityAddon.Core" Version="2.9.17.1332" />
<PackageReference Include="UnityAddon.Ef" Version="2.6.11.1315" />
<PackageReference Include="UnityAddon.Hangfire" Version="2.6.5.1316" />
<PackageReference Include="UnityAddon.Utilities" Version="2.0.16.1282" />
<PackageReference Include="WorkflowEngine.NETCore-Core" Version="4.1.4" />
<PackageReference Include="WorkflowEngine.NETCore-ProviderForMSSQL" Version="4.1.4" PrivateAssets="compile" />
<PackageReference Include="NexTore.DistributedTask.Client" Version="1.0.0.4210" />
</ItemGroup>