[Mono-list] How can the assembly check the OS it's on?
Fri, 7 Mar 2003 18:53:56 -0500
I would be interested to know what DotGNU Portable.NET and Rotor (Microsoft
Shared Source CLI) have for those values.
Maybe, Miguel de Icaza the next time he goes to an ECMA meeting he should
address this issue.
How do you determine in C# or .NET which CLI implementation you are running?
Rotor (MS SS CLI)
Then there are the different versions of the CLI implementation. For
.NET has 1.0, 1.1, ...
Mono has 0.21, 0.22, 0.23, ...
How do you determine if you are running on just a interpreter, Just-In-Time
compiler, or Ahead-Of-Time compiler? would these be considered features?
How do you determine the operating environment we are running?
Mono 0.21 on Cygwin 1.x.x on Windows XP Professional
Mono 0.21 on Windows XP Professional (not using Cygwin)
Mono 0.21 on Linux (Red Hat 7.2)
Mono 0.21 on FreeBSD (FreeBSD 5.0)
Mono 0.21 on Linux (Linux/S390)
Mono 0.21 on Mac OS X
How do you determine the archietecture?
Could all these CLI implementations agree to some common API or something?
From: Jonathan Pryor [mailto:email@example.com]
Sent: Friday, March 07, 2003 4:43 PM
To: Daniel Morgan
Cc: Charles-Louis; Mono List
Subject: RE: [Mono-list] How can the assembly check the OS it's on?
OSVersion just provides access to a PlatformID and a Version.
PlatformID is an enumerated type. The .NET version only goes into
detail for Win32 platforms (Win32S, Win32Windows, Win32NT). I don't
think .NET mentions Unix *at all*. If it does, it certainly won't
mention the myriad different flavors of Unix running around.
Mono can extend PlatformID (in fact, it added a Unix value), but if an
extended value is used under .NET, the results of expecting an extended
value are likely undefined. So this isn't a portable, long-term
On Fri, 2003-03-07 at 16:31, Daniel Morgan wrote:
> What about OSVersion and other properties found in System.Environment?
> -----Original Message-----
> From: firstname.lastname@example.org
> [mailto:email@example.com]On Behalf Of Jonathan Pryor
> Sent: Friday, March 07, 2003 4:25 PM
> To: Charles-Louis
> Cc: Mono List
> Subject: Re: [Mono-list] How can the assembly check the OS it's on?
> Easiest way I'm aware of is to check
> System.IO.Path.DirectorySeparatorChar. It's '\\' on Win32, '/' on Unix.
> Alas, I'm not aware of any other way, which pretty much prevents
> checking for Mac OS X vs. Linux vs. Solaris vs. AIX...
> I'd love to hear of a better form of checking.
> - Jon
> On Fri, 2003-03-07 at 10:44, Charles-Louis wrote:
> > Hi,
> > I was wondering if it was possible for an assembly to now on which OS it
> > is running?
> > eg. if I'm running on windows, I'll use the Windows System logs, and if
> > I'm on Linux, i'll use the Linux logs...
> > I'd like my compiled assembly to detect it, and I'd rather not use an
> > App.config file for this.
> > Is this possible?
> > Thanks
> Mono-list maillist - Monofirstname.lastname@example.org