MONO

From no name for this wiki
Jump to: navigation, search

Mono Befehle

Für eine ausführliche Auflistung siehe Mono Doc -> Mono Development Tools

  • Runtime starten: mono programm.exe
  • C# Compiler: mcs xy.cs oder gmcs xy.cs
  • C# Compiler, Assemblies referenzieren: mcs -r:System.Windows.Forms -r:System.Drawing simpleform.cs
  • Assembly linker: al
  • MSIL Compiler: ilasm
  • Disassembler in MSIL: monodis

Windows Forms

Hello World

simpleform.cs. Zum Kompilieren folgenden Befehl eingeben: mcs -r:System.Windows.Forms -r:System.Drawing simpleform.cs


nunit

Sample:

<?xml version='1.0'?>
<project basedir='.' default='all' name='testmaster'>

  <property name='nant.settings.currentframework' value='mono-2.0'/>
  <property name='build' value='bin'/>
  <property name='src' value='src'/>
  <property name='webappdir' value='webapplication'/>
  
  
  <!-- default target -->
  <target depends='copydll' name='all'/>  
  
  <!-- copy dll target -->
  <target depends='compile' name='copydll'>
  	<copy file='${build}/testmaster.dll' todir='${webappdir}/bin'/>
  </target>
  
    
  <!-- compile target -->
  <target name='compile'>       
   
    		<csc  debug='true'
    		      optimize='true' 
    		      output='${build}/testmaster.dll' 
    		      target='library' 
                  warninglevel='4'>
      
      		<sources>
        		<include name='**/*.cs'/>
      		</sources>
            
      		<references>
        		<include name='System.dll'/>
        		<include name='System.Data.dll'/>
          		<include name='System.XML.dll'/>
          		<include name='MySql.Data.dll'/>
          		<include name='System.Web.dll'/>
        	</references>
    	</csc>
  </target>
    
</project>

Taskreferenz: index

XSP

Webserver starten, Kommando:

xsp --root ./ --port 8080

Neuere Version

xsp2 --root ./ --port 8080

Wenn Root nicht angegeben wurde, dann ist das aktuelle Verzeichnis die Wurzel.

Ubuntu 9.10 MONO ASP.NET Server einrichten

In diesem Artikel wird beschrieben, wie die Sourcen von Mono auf einem Ubuntu 9.10 kompiliert und installiert werden.

Ubuntu 9.10 installieren und mono Sourcen herunterladen

Sourcen herunterladen:

wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.4.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.6.4.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.6.4.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.6.3.tar.bz2

Archive entpacken

bunzip2 mono-2.6.4.tar.bz2
bunzip2 libgdiplus-2.6.4.tar.bz2
bunzip2 xsp-2.6.3.tar.bz2
bunzip2 mod_mono-2.6.4.tar.bz2
tar xf mono-2.6.4.tar
tar xf libgdiplus-2.6.4.tar
tar xf xsp-2.6.4.tar
tar xf mod_mono-2.6.3.tar

Zusätzliche dev-Libraries installieren

apt-get install bison
apt-get install gettext
apt-get install libglib2.0-dev
apt-get install libpng12-dev
apt-get install libjpeg62-dev
apt-get install libtiff4-dev
apt-get install libx11-dev
apt-get install libfreetype6-dev
apt-get install libfontconfig1-dev
apt-get install libgif-dev
apt-get install g++
apt-get install apache2
apt-get install apache2-threaded-dev

Kompilieren

cd libgdiplus-2.6.2
./configure
export echo=echo
make
make install (als root)
cd ../mono-2.6.3
./configure
make
make install (als root)
cd ../xsp-2.6.3
./configure
make
make install (als root)
cd ../mod_mono-2.6.3
./configure
make
make install (als root)

Mod-Mono freischalten

cd /etc/apache2
mv mod_mono.conf mods-available
ln -s /etc/apache2/mods-available/mod_mono.conf /etc/apache2/mods-enabled/mod_mono.conf
/etc/init.d/apache2 restart

Testpage erstellen

Folgende Datei hinzufügen: Dateiname: default.aspx Verzeichnis: /var/www Inhalt:

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:Label ID="Label1" runat="server" Text="Hello from mono"></asp:Label>
    </div>
    </form>
</body>
</html>

Url aufrufen

http://localhost/default.aspx

Und Inhalt prüfen: Hello from mono

Resourcen