[Mono-list] How to detect which version of Mono a library is compiled with?
Jonathan Pryor
jonpryor at vt.edu
Wed May 16 18:23:51 UTC 2012
On May 11, 2012, at 2:54 PM, IBBoard wrote:
> What I want is a less hack-ish run script (currently using Bash). The proper way to do it is to check for features rather than string matching and version checking (which caused lots of JavaScript issues with people doing IE version checks badly). Is there a way to probe the profile that a Mono library was compiled with from Bash, without the ...-dev package being installed?
`monodis --assemblyref` will tell you which assemblies an assembly references, including version numbers, but (1) I don't know if monodis is in a -dev package or not (I imagine it is), and (2) I'm not sure that would actually help you, as you'd need to "somehow" find an assembly to run monodis against. Running it against your app won't help -- you know it's a 2.0 app -- so you'd presumably want System.dll or gtk-sharp.dll or something, and how do you find the appropriate path for _that_?
I'd suggest a different hack:
bindir=$(dirname `which mono`)
if [ -d "$bindir/../lib/mono/2.0" ]; then
# you have the 2.0 runtime...
else
# you don't; try for the 4.0 runtime and use `mono --runtime`...
fi
You may also need to check for lib64 in addition to lib (iirc Fedora likes lib64).
In general, if $prefix/lib/mono/2.0 exists, then the 2.0 profile exists.
- Jon
More information about the Mono-list
mailing list