如何使用Mono引用这些软件包以进行编译 [英] How to reference these packages with Mono in order to compile

查看:323
本文介绍了如何使用Mono引用这些软件包以进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to compile a C# script with Mono on Debian by command line, like this:

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一起提供.

I understand that I have to tell Mono which libraries to include by adding -pkg:whatever. My problem is that I do not know what these libraries are called, so I don't know what command is used to include them. Actually, I don't even know whether I have to download these libraries from somewhere or whether they come with Mono.

还要注意,最后2个是iTextSharp库,由于我不知道该怎么做,因此我将itextsharp.dll放在了与脚本相同的目录中.

Note also that the last 2 are the iTextSharp library, for which I have itextsharp.dll just placed in the same directory as the script, since I don't know what else to do with it.

请有人向我解释如何获取文件!

Please could someone explain to me how to get the file to compile!

推荐答案

尝试一下:

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

使用较新版本的mono,请尝试此操作.

With newer versions of mono, try this.

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

这篇关于如何使用Mono引用这些软件包以进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆