Could not load System.CodeDom

Hi, i added from nuget Aspose.Words (23.2.0). my project is wcf service net 6.0.

then added this code:

public void Pdf2Doc(string pathFileDoc)
{
    Document pdf = new Document(pathFileDoc);
    pdf.Save(Path.ChangeExtension(pathFileDoc, "docx"));
}

when run the application get this error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 

what can i do to fix it?

thanks.

@fabriziodb I cannot reproduce your problem, can you please provide more details about your environment, and add the Stack Trace of the exception?

now the erroor is changed, maybe aspose.words use SkiaSharp?

do i have to add SkiaSharp from nuget too?

{ ā€œtimeā€: ā€œ2023-02-21 21:06:13.7847ā€, ā€œlevelā€: ā€œERRORā€, ā€œmessageā€: "Plugin C:\Webs\DWA\plugins\JsonData.DWA Error: Could not load file or assembly ā€˜SkiaSharp, Version=2.80.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756ā€™. The system cannot find the file specified., InnerException: , StackTrace: ", ā€œeventPropertiesā€: { ā€œenvironmentā€: ā€œDevelopmentā€, ā€œdataā€: null } }

@fabriziodb Yes, Aspose.Words has a dependency on SkiaSharp.
https://www.nuget.org/packages/Aspose.Words#dependencies-body-tab
But Aspose.Words requires SkiaSharp 2.80.1 version or higher. In your exception message 2.80.0.0 version is requested.
I would suggest you to install Aspose.Words from NuGet, in this case all required dependencies will be installed automatically.

1 Like