Tôi đang cố gắng để biên dịch một kịch bản C# với Mono trên Debian bằng dòng lệnh, như thế này:Làm thế nào để tham khảo các gói với Mono để biên dịch
gmcs Main.cs
Tuy nhiên, tôi nhận được lỗi sau:
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
những tài liệu tham khảo ở đầu 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;
tôi hiểu rằng tôi phải nói Mono có thư viện để bao gồm bằng cách thêm -pkg:whatever
. Vấn đề của tôi là tôi không biết những gì các thư viện này được gọi là, vì vậy tôi không biết những gì lệnh được sử dụng để bao gồm chúng. Trên thực tế, tôi thậm chí không biết liệu tôi có phải tải xuống các thư viện này từ đâu đó hay liệu họ có đi với Mono hay không.
Cũng lưu ý rằng 2 thư viện cuối cùng là thư viện iTextSharp, mà tôi có itextsharp.dll
chỉ được đặt trong cùng thư mục với tập lệnh, vì tôi không biết phải làm gì khác với nó.
Xin vui lòng ai đó có thể giải thích cho tôi cách lấy tệp để biên dịch!
Nó hoạt động. Cảm ơn bạn! Tôi sẽ chấp nhận câu trả lời của bạn khi trang web cho phép tôi. – Alasdair
Với các phiên bản mono mới, hiện chỉ có một trình biên dịch và đó là mcs. – Salil
Trên OSX nó sẽ là 'mcs -reference: System.Drawing.dll Main.cs', v.v. Và điều này sẽ tìm thấy các tập tin trong cùng một thư mục. Có lẽ hiển nhiên, nhưng bạn không bao giờ biết. – atomicules