gpt4 book ai didi

c# - 如何在 ASP.NET Core 应用程序中使用位图资源?

转载 作者:行者123 更新时间:2023-11-30 22:57:53 24 4
gpt4 key购买 nike

我尝试在 .netcore2.1 应用程序中使用几个位图资源,但是当我将图像资源添加到我的项目时,它显示以下错误:

Severity Code Description Project File Line Suppression State Error Resource 'sign_here_tag' could not be instantiated. Type System.Drawing.Bitmap, System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 cannot be located.

我在我的项目中安装了 system.drawing.common NuGet 包,但错误仍然存​​在。

安装 CoreCompat.System.Drawing 后我仍然遇到这个错误: enter image description here

即使我将文件扩展名更改为 wav(以强制将其添加为 MemoryStream),我仍然会收到错误消息: enter image description here

最佳答案

要在 ASP.NET Core 中使用命名空间 System.Drawing,我建议您安装这个包:

CoreCompat.System.Drawing

Install-Package CoreCompat.System.Drawing -Version 1.0.0-beta006

(当然,删除您在安装此包之前尝试过的所有引用资料)

安装后,您可以正常使用System.Drawing.BitmapSystem.Drawing.Image

注意:如果您想在类库中使用此包,请确保该库使用的是 .NET Standard

关于c# - 如何在 ASP.NET Core 应用程序中使用位图资源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53341354/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com