简体   繁体   English

未找到 PrivateFontCollection c# (linux) 中的错误

[英]PrivateFontCollection not found Error in c# (linux)

I'm using command dotnet build in order to build a game in the MonoGame framework in Ubuntu 20.04 using .NET 5.0 .我正在使用命令dotnet build以使用.NET 5.0在 Ubuntu 20.04 的 MonoGame 框架中构建游戏。 It was fine in Windows, but now that I'm using it here, it gives me this error:在 Windows 中很好,但是现在我在这里使用它,它给了我这个错误:

error CS1069: The type name 'PrivateFontCollection' could not be found in the namespace 'System.Drawing.Text'.错误 CS1069:在命名空间“System.Drawing.Text”中找不到类型名称“PrivateFontCollection”。 This type has been forwarded to assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.此类型已转发到程序集 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 考虑添加对该程序集的引用。 [/home/mrwoto/Ali/Programming/csharp/SAO/SAO/SAO.csproj] [/home/mrwoto/Ali/Programming/csharp/SAO/SAO/SAO.csproj]

So, is there anyway to resolve it?那么,有没有办法解决呢? How can I add a reference to it in .csproj file?如何在.csproj文件中添加对它的引用?

One option is to add it from the terminal with一种选择是从终端添加它

dotnet add package System.Drawing.Common

After this, you should be able to see something like the following in the .csproj file.在此之后,您应该能够在.csproj文件中看到类似以下内容。

<PackageReference Include="System.Drawing.Common" Version="5.0.2" />

Please note that dotnet add is more than just adding some text to csproj.请注意, dotnet add不仅仅是向 csproj 添加一些文本。

From dotnet add package :dotnet 添加 package

The dotnet add package command provides a convenient option to add a package reference to a project file. dotnet add package 命令提供了一个方便的选项,可将 package 引用添加到项目文件。 After running the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project.运行命令后,会进行兼容性检查,以确保 package 与项目中的框架兼容。 If the check passes, a <PackageReference> element is added to the project file and dotnet restore is run.如果检查通过,则将<PackageReference>元素添加到项目文件并运行 dotnet restore。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM