How can I get the current OS architecture using Mono?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This may be possible.
There’s no way to do this is proper plain Jane .NET, Environment (where’d you expect this to be) doesn’t expose it.
But Mono has the
Mono.Unix.Nativenamespace (you’ll need to add a reference to Mono.Posix.dll), which has the Syscall class. This exposesuname, which may give you what you want; this doesn’t seem terribly standard across Linux/Unix versions, and I’m not sure how much normalizing Mono is doing here.When I run this on my Mac,
results.machineis set tox86_64. I don’t have a Linux machine handy to test for consistency; but this would be the way to do it if there’s any at all.