问题
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
- 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 - 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