Tybuild is a small replacement for the msbuild tool used to compile programs
from .sln or .csproj files as (at the time of writing) Mono xbuild support for
vs2008 solutions/projects is limited.  It is not designed as a replacement for
xbuild/msbuild in everyday scenarios as it does not fully interpret the
msbuild format properly but rather relies on vs2008 defining various values in
the files which it picks up and uses.  It attempts to work on both
windows/.NET and unix/mono environments by guessing at the compiler and
assembly names.  Specifically, the rules used are:

tools_ver = //Project/@ToolsVersion (XPath format, from project file)
if Environment.OSVersion.Platform == PlatformID.Unix or 128 (old mono versions)
	// Assume we're on mono
	
	if tools_ver == "2.0" or "3.0" or "3.5"
		csc = "gmcs"
	else
		csc = "mcs"
	fi

	ref_dir = ""
else if Environment.OSVersion.Platform == PlatformID.WinCE
	error and halt
else
	// Assume windows

	framework_dir = $WINDIR\\Microsoft.NET\\Framework
	
	foreach subdirectory of framework_dir matching "v" + tools_ver + "*" do
		if subdirectory contains "csc.exe"
			csc = framework_dir + subdirectory + "csc.exe"
			break
		fi
	od

	if csc == ""
		csc = "csc.exe"
	fi

	if tools_ver == "2.0" or "3.0" or "3.5"
		fwork_dir = "2.0"
	else
		fwork_dir = tools_ver
	fi

	foreach subdirectory of framework_dir matching "v" + fwork_dir + "*" do
		if subdirectory contains "System.dll"
			ref_dir = framework_dir + subdirectory
			break
		fi
	od

	if ref_dir == ""
		ref_dir = framework_dir + "v2.0.50727"
	fi
fi

