0

I found these registry settings

enter image description here

Assuming the user installed the Mono 64 bit MSI, can I in C# code read the registry and rely on

  • 1 + 2 indicating that Mono 64 bit is installed
  • 3 where the Mono lib folder is
  • 4 where Mono config folder is and
  • 5 where the mono-2.0-sgen.dll is located.

I am asking because

  1. I did not find this documented on the Mono website (e.g. Mono FAQ: Technical, Install Mono on Windows, Mono Runtime Documentation, Mono Runtime Documentation)
  2. Perhaps there is a better / alternative approach. (e.g. the GAC ... I'm not keen on the GAC but perhaps ...)

(I assume that anything under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node would be 32 bit and would not indicate 64bit mono.)


Update I've asked on Mono-Github and here's their answer: https://github.com/mono/mono/issues/10535

robor
  • 2,969
  • 2
  • 31
  • 48
  • so now you know how to programmingly detect if mono is installed and where.... just look for those reg keys – BugFinder Sep 10 '18 at 09:07
  • @BugFinder I did not find this documented anywhere ... can I rely on this? – robor Sep 10 '18 at 09:10
  • 1
    Most of the time these things are undocumented. If you do a test on a bunch of boxes, if its there for all, you should be able to assume its reliable – BugFinder Sep 10 '18 at 09:28
  • 1
    @robor78 You might want to post an issue on the Mono repo to ask if those registry entries are "stable" – SushiHangover Sep 10 '18 at 11:24

1 Answers1

0

.NET provides a series of classes for reading registry entry Here is an example of how to do that. Another example is here

In your case, the key location is number 1 from picture posted, the key is "Architecture" and it's "x64" and so on

Try that code from the above link and see if works. Some adaptation needs to be done.

If you get an error regarding administrative rights try to run Visual Studio as administrator.

cosmin_popescu
  • 186
  • 4
  • 16