Can't get Microsoft.VisualBasic.dll for Mono 2.10
Asked Answered
C

3

0

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.

Cupreous answered 10/7, 2011 at 22:29 Comment(3)
Why do you need the TotalPhysicalMemory? Your application should not depend on knowing the size of the physical memory. Is it just for diagnostics? You could simply remove the dependency on the property, or try to determine the memory size on Linux systems in a Linux-specific way. P/Invoking into the Win32 API does not help, because Linux is not Win32.Psychognosis
I didn't write the code that uses the TotalPhysicalMemory. It's from the Cudafy.NET library and they use it when emulating a GPU to set up the device properties.Cupreous
It looks like Cudafy.NET isn't designed to work with Mono. The dependence on the Microsoft.VisualBasic assembly is probably just the tip of the iceberg. Try to find a different library that works with Mono, or contact the Cudafy.NET developer and ask for Mono support.Psychognosis
F
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

Fritillary answered 10/7, 2011 at 23:32 Comment(0)
C
1

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();
Cosmopolite answered 13/7, 2012 at 14:42 Comment(0)
V
0

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.

Varanasi answered 11/7, 2011 at 20:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.