- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将面向完整框架的 Asp.Net Core 2.2 网站转换为面向 .Net Core 3.1 的 Asp.Net Core 3.1 应用程序。我有点不清楚与 System.Drawing 相关的依赖关系以及如何实现它们。
我的项目使用 System.Drawing,在 Asp.Net Core 3.1 下编译时出现此错误,提示我添加了对 System.Drawing.Common.dll
的引用。 :
Error CS1069: The type name 'Image' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly. 1-wwwGiftOasis3 C:\Users\Ron\source\repos\wwwGiftOasis3\wwwGiftOasis3\site\seller\profile\about\s-photos.cs
System.Drawing.Common.dll
添加引用的方法所以我假设我应该通过 NuGet 添加引用。
System.Drawing.Common
看起来像我想要的包,但我不清楚我的项目是否满足依赖项:
Microsoft.NETCore.App
完成 NuGet 包的
Microsoft.NETCore.Platforms
依赖?
Microsoft.Win32.SystemEvents
依赖?
最佳答案
System.Drawing
使用特定于 Windows 的 API,因此与跨平台的 .NET Core 不兼容。微软创建 System.Drawing.Common
作为 System.Drawing
的就地替代品对于 .NET 核心。它是一个精确的 API 替代品,但以跨平台的方式执行图像操作,而不是特定于 Windows 的方式。
总而言之,是的,您只需将 NuGet 放入您的项目中,然后前往镇上即可。您无需担心其他任何事情。
关于asp.net-core - 如何在 Asp.Net Core 3 中访问 System.Drawing 即 System.Drawing.Common,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59324386/
我是一名优秀的程序员,十分优秀!