2011-11-25 8 views
25

Estoy intentando compilar una secuencia de comandos de C# con Mono en Debian por línea de comandos, así:cómo hacer referencia a estos paquetes con Mono con el fin de recopilar

gmcs Main.cs 

Sin embargo, me sale 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 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; 

yo entiendo que tengo que contar 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 usar para incluirlas. En realidad, ni siquiera sé si tengo que descargar estas bibliotecas desde algún lugar o si vienen con Mono.

Tenga en cuenta también que los últimos 2 son la biblioteca iTextSharp, para la cual tengo itextsharp.dll que acaba de colocar en el mismo directorio que el script, ya que no sé qué más hacer con él.

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

Respuesta

42

Prueba esto:

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

Con las nuevas versiones de mono, prueba esto.

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

Funcionó. ¡Gracias! Aceptaré tu respuesta cuando el sitio me lo permita. – Alasdair

+2

Con las nuevas versiones mono, solo hay un compilador ahora y eso es mcs. – Salil

+0

En OSX sería 'mcs -reference: System.Drawing.dll Main.cs', etc. Y esto encontrará los archivos en el mismo directorio. Probablemente sea obvio, pero nunca se sabe. – atomicules

5

Aquí hay otra solución que ha funcionado para mí en un caso similar donde conseguí 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? 

tuve esas referencias en mi programa:

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

Tengo la solución desde ubuntuforums:

gmcs -pkg:dotnet *.cs 
+1

mcs -pkg: dotnet * .cs funcionó para mí! – Tiago

0

Tengo este error, y cuando sólo tenía que utilizar System.Net.Http, he utilizado:

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

y funcionó bien para mí. Cuando traté de incluir la ruta completa al System.Net.Http.dll, no funcionó. Es decir, cara a cara, mono realiza un seguimiento de los caminos. Además, tengo la última versión de mono.

Cuestiones relacionadas