
 .NET/Mono bindings for libLAS - ASPRS LiDAR data translation toolset
==============================================================================

This directory consists of all components of .NET/Mono bindings for libLAS.


Building with Visual Studio 2003/2005/2008 and .NET Framework
------------------------------------------------------------------------------

Requirements:

* Visual Studio 2003, 2005 or 2008 
* .NET Framework 1.x, 2.0 or 3.0

Steps:

1. Build libLAS C++ and C DLLs

nmake /f makefile.vc

or

Open trunk/build/msvc80/liblas.sln in VS2005 or VS2008. Build the solution. Successfull build is required for only two projects: liblas_lib.vcproj and liblas_c_dll.vcproj.

2. Load trunk/csharp/dotnetLibLAS.sln in VS2005/2008 and build solution dotnetLibLAS dll.

or

Now, in order to build .NET bindings, one can do:

2.1. cd trunk/csharp
2.2. nmake -f makefile.vc

To clean:

2.3. nmake -f makefile.vc clean

To rebuild:

2.4. nmake -f makefile.vc rebuild

This makefile is just a tiny proxy calling MSBuild which in turn
builds the dotnetLibLAS.sln solution. Debug/Release builds is controlled by BUILD_DEBUG variable defined in nmake.opt.

Notes:
- To build dotnetLibLAS is not mandatory build the native C/C++ library but it is if you want use the .NET bindings.
- dotnetLibLAS search liblas1.dll according the Dynamic-Link Library Search Order of Windows:
  http://msdn.microsoft.com/en-us/library/ms682586.aspx
- If you try the HelloWorldLAS sample and you have a P/Invoke exception, perhaps is because the .NET bindings don`t find the native DLL.

Register the dotnetLibLAS Assembly in the GAC in Windows/.NET and Unix/Mono
------------------------------------------------------------------------------
1. Use the sn.exe tool to create a new key file in trunk/csharp/dotnetLibLAS:
sn -k liblas.snk

2. Add your assembly to the GAC

gacutil /i dotnetLibLAS.dll

To uninstall this assembly from the GAC, use the command:

3. gacutil /u dotnetLibLAS

Notes:
- This operation is not recomended by now. Remember you need have the Native DLL install in your computer.
- If your path environment variables aren't set, you'll have to go to the C:\Program Files\Microsoft.NET\FrameworkSDK\Bin\ directory to run sn.exe

Run the test
------------------------------------------------------------------------------
dotnetLibLAS use the NUNIT library to testing:
http://www.nunit.org/index.php

Steps to run the test:

1. Download the last NUNIT version:
   http://prdownloads.sourceforge.net/nunit/NUnit-2.4.8-net-2.0.msi?download

2. Install NUNIT in your computer to have the NUNIT assembly and the NUNIT applications to run the test.

3. Open the NUNIT test project from trunk/csharp/dotnetLibLAS/NUnitTest

3. Update the nunit.dll reference in the properties of the project.

or

if you have problems delete nunit.dll reference and add it. Previous NUNIT intallation installed nunit.dll in the GAC for you.

4. From Windows Start Menu\Programs menu open the NUnit Gui Runner application.
   http://www.nunit.org/index.php?p=nunit-gui&r=2.4.8

   or 
  
   use the NUnit-Console applications instead:
   http://www.nunit.org/index.php?p=nunit-console&r=2.4.8

5. Run the test of this assembly:
   trunk/csharp/csharp/NUnitTest/bin/release/NUnitTest.dll


Building with Mono
------------------------------------------------------------------------------

To build liblas for MONO you need have installed these dependencies:

1. mono mono-gmcs mono-gac mono-utils
   mono is the Virtual machine o run the applications.
   gmcs is the compiler of the c# programming language.

2. In debian (or variants like ubuntu):
   sudo apt-get install mono mono-gmcs mono-gac mono-utils

Further you could need these dependencies if need unit testing with NUNIT

1. nunit libmono-i18n2.0-cil nunit-console
   sudo apt-get install libmono-i18n2.0-cil nunit nunit-console
   nunit is the assembly to link to your unit test projects.
   nunit-console is the tool to run the tests.
   

Notes:
- NUNIT by now have bad support in the linux repositories. Perhaps the best is download it from the official web.
  You can use the compiled version of NUNIT for windows:
  http://prdownloads.sourceforge.net/nunit/NUnit-2.4.8-net-2.0.zip?download
  The basic assemblies are:
  nunit.core.dll
  nunit.core.interfaces.dll
  nunit.framework.dll
  nunit.util.dll
  nunit-console.exe
  nunit-console-runner.dll

Using Monodevelop
------------------------------------------------------------------------------
You could install also Monodevelop 1.x if you want have a full IDE for C#.
The problem i see with this IDE now is it have an own build system. You can open Visual studio projects but with bad support.
In Monodevelop 2.x (in alpha status yet) you work with visual studio solutions files like native format of the IDE.
http://monodevelop.com/Release_notes_for_MonoDevelop_2.0_Alpha_1#MSBuild_File_format

Besides msbuild system in MONO is xbuild. This will let us in the future release the dotnetLibLAS bindings with visual studio solutions.
By now xbuild is not complete.
http://www.mono-project.com/Microsoft.Build


Compiling dotnetLibLAS in MONO
------------------------------------------------------------------------------
By now dotnetLibLAS is not officially supported by MONO but it's possible use it:

1. You can use the compiled library you have in windows. It's fully compatible.

2. Compile the library by hand.
   gmcs /target:library /out:dotnetLibLAS.dll *.cs /keyfile:liblas.snk
   You must run this command in the /trunk/csharp/dotnetLibLAS folder.

3. Autools. TODO

Notes:
In the project folder you can see this file dotnetLibLAS.dll.config.
This file maps the linux shared library from the windows native DLL. The names shared libraries in windows and linux are different.
You need have always this file in your linux applications folder. MONO read this XML file before our dotnetLibLAS assembly.

Run the tests in MONO
------------------------------------------------------------------------------
By now you need compile and run the tests by hand.

1. The test are in the folder /trunk/csharp/NUnitTest

2. You need have the assemblies of nunit and dotnetLibLAS referenced to the library.

3. Run this command to compile the library:
   gmcs /target:library /r:nunit.framework.dll /r:dotnetLibLAS.dll /out:pruebaunit.dll *.cs
   
4. Run the tests:
   mono nunit-console.exe pruebaunit.dll

$Id$
