Cannot load type from load type 'System.Drawing.Font' from assembly 'System.Drawing, Version=4.0.0.0

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:24:54

问题


I know there are similar questions but i couldn't find the answer so i will ask a specif question. I have a simple .net core console application. I'm using the Syncfusion.DocIO.Base and Syncfusion.Core assemblies to create a WordDocument from a stream like this:

var word = new WordDocument(rtfStream, FormatType.Rtf);

here i get the error message: Could not load type 'System.Drawing.Font' from assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.'

Do you have any idea where can i look to reslove this problem?`


回答1:


The type System.Drawing.Font is not available in .NET Core 2.0. While .NET Core has a System.Drawing.dll and System.Drawing.Primitives.dll, those do not contain this type just as many more expected by libraries making use of the full .NET Framework's drawing capabilities.

Support for these features is planned for .NET Core 2.1, see the related GitHub issue.




回答2:


You have referred base assemblies which contains “System.Drawing” reference which is not supported in ASP.NET Core application.

So, please refer the following assemblies/NuGet packages to work with Word documents using Essential DocIO in ASP.NET Core.

Syncfusion.Compression.Portable
Syncfusion.DocIO.Portable
Syncfusion.OfficeChart.Portable
  1. You can find the installed assemblies and NuGet packages from below location.
    $system drive:\Users\$user.nuget\packages\Syncfusion.DocIO.Portable Eg : C:\Users\username.nuget\packages\Syncfusion.DocIO.Portable
  2. You can find the ASP.NET Core NuGet packages in online from below link. http://nuget.syncfusion.com/package/aspnetcore

Please refer the below link to know more about migration changes for ASP.NET Core. https://help.syncfusion.com/aspnet-core/release-notes/migratingtov15.3.0.26?type=all

Please refer the below UG documentation links to know more about ASP.NET Core configuration with Essential DocIO.

https://help.syncfusion.com/aspnet-core/gettingstarted/getting-started-1-1-0 https://help.syncfusion.com/aspnet-core/installation

https://help.syncfusion.com/aspnet-core/gettingstarted/getting-started-1-1-0#configure-syncfusion-file-format-components-in-aspnet-core-application

https://help.syncfusion.com/aspnet-core/docio/overview

For further questions please contact our support team at support@syncfusion.com to get a prompt assistance on this.



来源:https://stackoverflow.com/questions/47226811/cannot-load-type-from-load-type-system-drawing-font-from-assembly-system-draw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!