Can't get Microsoft.VisualBasic.dll for Mono 2.10 - c#

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.

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

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();

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.

Related

Linux JetBrains Rider can't use Mono, while it is installed in the system

I am currently using Manjaro Linux 20.2, with official JetBrains Rider from JetBrains Toolbox
I have installed this package package screenshot
When I'm writing in my terminal "mono" it runs.
File location also looks fine.
When I'm opening my Environment tab in Rider. I got this.
Environment Tab
I can create and run/execute/debug any projects with my .NET CORE
But I can't use the framework at all.
A simple application like this New Project Window
And here... the error
In my settings -> build and execution -> I have these parameters
path settings
I don't know what to do and how to fix this error. Tried many times disinstall/reinstall the Mono Package. But it's always the same.
Maybe I should change somehow a Mono path here in Rider Settings ?
But I don't know to where.. there are so many of these files in usr/lib and usr/bin
Please help me, I don't know what to do next and how to fix this..
I just know for sure. That it is possible to run Mono on UNIX.
Something is wrong..
UPD1: I've discovered, that to run Mono on Linux. I should install a different package "monodevelop"
But according to GitHub, this package is not build-able on Linux anymore (only on MacOS)
I've discovered this "dotdevelop" package..
https://github.com/dotdevelop/dotdevelop
But I don't know, it's looks like it doesn't work for me either.
Or maybe I'm just putting a wrong file to my mono path settings in Rider..
UPD2: Maybe there is still hope for me, if I'll use .NET FRAMEWORK from inside a container ?
https://hub.docker.com/_/microsoft-dotnet-framework
I know how to use Docker. It will be possible to use it in my Rider ? I don't get it.
This answer essentially has what you're looking for. There is an issue in recent mono packages for some distributions that causes Rider not to have a proper reference to the mono libraries.
JetBrains Rider not detecting mono or Unity API
I've tried this on Debian 11 and it works as expected. I also use an Ubuntu machine and I didn't have to do this. I'm not entirely sure why, all I know is that some distros need the override set in in order to work. I use KDE Plasma and used their method of setting environment variables. There's a million ways to do that, check Majaro's documentation for what's best for your system.
**Before reading below, be aware that we're talking about legacy software and there's no guaranty that Mono will work in the future since it has been superseded by .NET (core). New development should be done there rather than Mono/.NET Framework unless you really need to. Just be aware it's legacy at this point and ymmv.
As for the other comment that there is no .NET Framework on Linux, that's not completely true. Mono is the .NET Framework implementation for Linux and macOS. It supports a large portion of the .NET Framework that exists in the Windows version, however it has some drawbacks.
For instance, WinForms is only partially supported and extremely buggy. WPF will not work at all.
ASP.NET can be run under Apache with a plugin, however it doesn't support all of the frameworks that you can use on Windows. For modern .NET web development on non Windows platforms, .NET 5+ should be used.
Another weird one is that the Console.Beep() method works unreliably. The Console.Beep(int frequency, int duration) method also doesn't work on macOS at all.
Other than those examples, there's other things that won't work which are mainly things that rely directly on the Windows API though it's possible to run .NET in some capacity under WINE. This isn't recommended though. Anything that uses COM will not work as well. It's also practically impossible to use a printer so that's probably out.
You can review https://www.mono-project.com/docs/about-mono/compatibility/ for a better list of what is and isn't supported.
For console applications, mono works quite well. Just be aware that not everything will work.
Good luck!
You should create a console application by choosing "Console Application" under ".NET Core".
I wonder why Rider guys decided to show the projects under ".NET" to mess things up. Beginners like you won't be easy to know what they are and how to run them on non-Windows machines.

Saxonica 9.7 HE in C#

I'm trying to get Saxon 9.7 HE up and running in C#, and failing miserably.
As per instructions, I am downloading and running https://sourceforge.net/projects/saxon/files/Saxon-HE/9.7/SaxonHE9-7-0-14N-setup.exe/download
This installs a bunch of files into C:\Program Files\Saxonica\SaxonHE9.7N.
In the bin folder inside this one, the following files are present:
No matter which DLLs I add as references to my project, the "using Saxon.Api;" reference fails to resolve.
Am I using the correct DLLs here? Is it some sort of .Net version mismatch? My class library project is set to .Net 3.5 currently.
Thanks for any help
The minimum supported version of .NET for Saxon is indeed 4.0.
The bug is in the documentation which will be updated shortly: See bug issue: https://saxonica.plan.io/issues/3085
Thanks for reporting the issue.
Some guess work here. But the dependency on .net 4 is most likley from the compiling of the C# wrapper over the saxon java library that was converted using IKVM. IKVM says it only requires .net 2.0, so I think the only place that dependancy can come from is the saxon9he-api.
You should be able to build this yourself, its quite thin.
https://dev.saxonica.com/repos/archive/opensource/latest9.7/hen/csource/api/Saxon.Api/
Otherwise if its a show stopper ask Michael Kay (the author), he's pretty active on stack overflow.
Updated
I was curious so I checked, the .Net 4 dependency seems to come from the saxon9he-api (which i'm fairly certain could be re-compiled under 3.5 with no/minimal changes), the same for the Query and Transform exe's.

Can I use MONO to create a program that runs without the .NET framework being installed?

I need to write something for a Windows XP embedded computer, which does not have .NET installed.
I already have written the program in .NET, so I'm wondering if there's a way to make it run without .NET?
Perhaps using MONO to create some all-in-one .exe?
Thanks for any thoughts / ideas!
Take a look at mkbundle from Mono:
The resulting executable is self contained and does not need the Mono
runtime installed to run.
When running managed code - .NET/Mono assemblies, a framework is required to be installed. Depending on your dependencies, you may be able to run under mono without modification. Mono is compatible with Windows XP. Parts of .NET are not compatible with Mono such as WPF.
Firstly make it run without .NET is an error concept. .net program must run at .net Environment. You can say without .netframework.
If you want to use .netframework, may these can help you:
http://blogs.msdn.com/b/embedded/archive/2007/03/23/deploying-net-framework-3-0-desktop-distribution-package-on-windows-xp-embedded-sp2-runtime.aspx
http://social.msdn.microsoft.com/Forums/en-US/93e39489-2c61-439d-aa3f-865195fb79d7/net-framework-35-on-windows-xp-embedded?forum=embeddedwindowscomponents
Or you can setup monoruntime on this os

mono problems with parallel extensions

i have a program written in visual studio 2008 c# which uses
System.Threading.Tasks.Paralell.For(...
now i want to run it in linux environment using mono, is it possible? if so how?
currently i have Mono Jit compiler version 2.4.2.3 , it cannot run the above program...
Mono 2.4.2.3 does not support Parallel LINQ. If you're not afraid of compiling mono from sources, I'd recommend doing that.
As you may know Thread management is very tied and closed to the underlying OS. The Mono team has not yet completed an implement of the TPL for Linux and I have some doubt that they will be able to achieve it soon as they have to implement it to every OS they support.
In fact you get the beggining of an implementation made during the Google Summer of Code 2008 by Jeremie Laval : http://code.google.com/p/mono-soc-2008/source/browse/#svn/trunk/parallelfx
You can get more info about this implementation here : http://blog.netmedia.info/2008/07/29/c-30-and-parallel-fxlinq-in-mono/
You could try the PFX implmentation by Jeremie Laval for Mono, but I have found that it is subtly different than the Microsoft implementation, so there may be some porting required to get things to work correctly.
That being said, another potential possibility (untested) would be to use the new Reactive Framework for .NET 3.5sp1, and see if it works on Mono. It includes a backport of the PFX libraries, in their current API. It may work correctly on Mono (but, as I said, it's not tested or supported there).

Embedding .Net Runtime

Am I able to embed the .net runtime so that .net is not required on the host operating system? I was looking at doing this with Mono by looking here: http://mono-project.com/Embedding_Mono but seems to allude to using external modules to accomplish this. My goal is to have one single executable with no installed .net runtime. I do not know how this would be configured in my application to compile the native code, link the mono runtime- as well as compile the C# code and link that as well?
You can now statically compile Mono assemblies as was just demonstrated at PDC. The purpose of doing this was to allow .Net applications to run on the iPhone, but this should work anywhere.
There are some limitations to this; obviously, it can't depend on runtime-generated code, so Reflection.Emit is out.
Third-party solution i've used with much success: Xenocode
This is not currently supported, and AFAIK there are no plans to change that status.
There are some third party tools out there that try to do this for you, but last time I checked none were very good yet.

Categories