Cómo hacer referencia a estos paquetes con Mono para compilar


Estoy tratando de compilar un script C# con Mono en Debian por línea de comandos, así:

gmcs Main.cs

Sin embargo, obtengo el siguiente error:

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

Estas son las referencias en la parte superior de 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;

Entiendo que tengo que decirle a Mono qué bibliotecas incluir agregando -pkg:whatever. Mi problema es que no sé cómo se llaman estas bibliotecas, así que no sé qué comando se usa para incluirlas. En realidad, ni siquiera sé si tengo que descargar estas bibliotecas de alguna parte o si vienen con Mono.

Tenga en cuenta también que los últimos 2 son la biblioteca iTextSharp, para la que he itextsharp.dll colocado en el mismo directorio que el script, ya que no se que más hacer con él.

¡Por favor, alguien podría explicarme cómo obtener el archivo para compilar!

 28
Author: user202729, 2011-11-25

3 answers

Prueba esto:

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

Con las versiones más recientes de mono, pruebe esto.

mcs /reference:System.Drawing.dll /reference:itextsharp.dll Main.cs
 46
Author: icktoofay,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-01 00:10:16

Aquí hay otra solución que me funcionó en un caso similar donde obtuve este error:

Eventdemo.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing `System.Drawing' assembly reference?
Eventdemo.cs(3,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?                           │
Eventdemo.cs(8,19): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?  

Tenía esas referencias en mi programa:

using System;
using System.Drawing;
using System.Windows.Forms; 

Obtuve la solución de ubuntuforums :

 gmcs -pkg:dotnet *.cs
 5
Author: milia,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-02 21:45:01

Recibí este error, y cuando solo necesitaba usar System.Net.Http, usé:

$mcs /reference:System.Net.Http.dll Program.cs

Y funcionó bien para mí. Cuando traté de incluir el camino completo a System.Net.Http.dll, no funcionó. Es decir, heads up, mono realiza un seguimiento de los caminos. Además, tengo la última versión de mono.

 0
Author: Max,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-04 20:24:56