[Mono-list] How to find mono path on windows? Solved! code attached
Xavi de Blas
xaviblas at gmail.com
Sun Aug 26 12:13:55 EDT 2007
Hello
Thanks for the solution!
I don't know anything about the registry and it take me some time to
code this on Mono. Finally i done and i write here. I hope this helps
anyone
/*
* Find mono path in windows
* Based on: http://www.mono-project.com/FAQ:_Technical
*/
using System;
using System.Diagnostics; //for detect OS
using System.IO; //for detect OS
using Microsoft.Win32;
class Test {
public static void Main() {
OperatingSystem os = Environment.OSVersion;
if(os.Platform.ToString().ToUpper().StartsWith("WIN"))
{
RegistryKey rkHKLM = Registry.LocalMachine;
RegistryKey rkRun;
try
{
rkRun = rkHKLM.OpenSubKey("Software\\Novell\\Mono",false);
string version = rkRun.GetValue("DefaultCLR").ToString();
rkRun = rkHKLM.OpenSubKey("Software\\Novell\\Mono\\" + version,false);
Console.WriteLine (rkRun.GetValue("SdkInstallRoot"));
}
catch
{
Console.WriteLine("Unable to find mono version!");
rkHKLM.Close();
}
}
}
}
Bye
2007/8/26, Gert Driesen <gert.driesen at telenet.be>:
> Xavi,
>
> You can get the path from HKLM\SOFTWARE\Novell\Mono\<version>.
>
> Gert
>
> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com
> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Xavi de Blas
> Sent: zondag 26 augustus 2007 15:13
> To: mono-list at lists.ximian.com
> Subject: [Mono-list] How to find mono path on windows?
>
> Hello all, i want to create a .bat that executes my app
>
> Something like:
>
> @"C:\ARCHIV~1\MONO-1~1.5\bin\mono.exe"
> "C:\ARCHIV~1\MONO-1~1.5\samples\gtk-sharp-2.0\GtkDemo\GtkDemo.exe" %*
>
> But, how to do it if i don't know where user installed mono? I mean, mono is
> installed by user, and my software needs to create the .bat.
>
> Thanks
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
More information about the Mono-list
mailing list