问题
I've been trying to port a .NET library built on/for Windows to Ubuntu 11.04 using Mono. The library uses .NET 4.0 so the version of mono (2.6.7) that is standard with Ubuntu 11.04 doesn't cut it. Specifically, I'm trying to use Microsoft.VisualBasic.Devices.Computer.Info.TotalPhysicalMemory. I've searched high and low for packages or parallel build scripts that install Microsoft.VisualBasic.dll, but none of them do.
Ideally I'd like to find a way to get the best of both worlds, Mono with .NET 4.0 support and Microsoft.VisualBasic so that the code won't have to be modified. I would settle for an alternative that uses another method (although, the P/Invoke method I saw in this previous post does not appeal to me).
Any help is greatly appreciated.
回答1:
It looks like getting VB.dll won't help you either. This method is not implemented in Mono:
https://github.com/mono/mono-basic/blob/master/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.Devices/ComputerInfo.vb
回答2:
You could try to fool Cudafy by creating your own version of the DLL.
Use reflector or check here to see the interface
https://github.com/mono/mono-basic/blob/master/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.Devices/ComputerInfo.vb
You can use a performance counter on Mono to actually get the amount of memory;
var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
var mem = pc.RawValue();
回答3:
You can use the MoMA tool to check how compatible mono is for your project.
In your particular case the method you need isn't implemented, if that's the only thing preventing your project from working, you can implement it, and build and provide your own MS.VB.dll until mono releases a version with the change in it. Once you've built mono-basic it's simple to install on any machine (with mono already installed), just run:
gacutil -i path/to/MS.VB.dll
and the dll will be installed into the gac.
来源:https://stackoverflow.com/questions/6644165/cant-get-microsoft-visualbasic-dll-for-mono-2-10