gpt4 book ai didi

c# - 如何用 Mono 引用这些包以便编译

转载 作者:IT王子 更新时间:2023-10-29 04:10:56 25 4
gpt4 key购买 nike

我正在尝试通过命令行在 Debian 上使用 Mono 编译 C# 脚本,如下所示:

gmcs Main.cs

但是,我收到以下错误:

Main.cs(6,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(7,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(12,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(13,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(1526,31): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(6,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(7,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Main.cs(12,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Main.cs(13,7): error CS0246: The type or namespace name `iTextSharp' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 9 error(s), 1 warnings

Main.cs 顶部的引用:

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using iTextSharp.text;
using iTextSharp.text.pdf;

我知道我必须通过添加 -pkg:whatever 告诉 Mono 要包含哪些库。我的问题是我不知道这些库叫什么,所以我不知道用什么命令来包含它们。实际上,我什至不知道我是否必须从某个地方下载这些库,或者它们是否与 Mono 一起提供。

另请注意,最后两个是 iTextSharp 库,我将 itextsharp.dll 放在与脚本相同的目录中,因为我不知道还能用它做什么.

请有人向我解释如何让文件编译!

最佳答案

试试这个:

gmcs /reference:System.Drawing.dll /reference:itextsharp.dll Main.cs

使用较新版本的单声道,试试这个。

mcs /reference:System.Drawing.dll /reference:itextsharp.dll Main.cs

关于c# - 如何用 Mono 引用这些包以便编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8264783/

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