VisualBasic.NET support


Visual Basic.NET support in Mono is relatively new. The Visual Basic runtime has been available for Mono for a while, and with the release of Mono 1.2.3, the Visual Basic support will be complete, with the introduction of a self-hosting compiler and class libraries for Visual Basic development on any of the Mono supported systems. For more information, read Novell's announcement (http://www.novell.com/news/press/item.jsp?id=1289) on the Visual Basic compiler.

Having a native compiler for Visual Basic not only allows developers that wish to complete develop in a Mono supported platform, but also allows applications that depend on the CodeDOM (ASP.NET for example) to be developed using Visual Basic. Something that before the availability of the compiler was not possible.

New Visual Basic Framework

A new Visual Basic.NET framework is under development, and it consists of two components: a new VB.NET compiler written in VB.NET (developed by Rolf Bjarne Kvinge) and a new VB.NET runtime developed completely in VB.NET under development at Mainsoft by Rafael Mizrahi and Boris Kirzner.

The new runtime is being developed in VB.NET and does no longer require the ILASM and Perl hacks that were required to implement the Visual Basic runtime as we did in the past. The new runtime also contains a large collection of regression tests to ensure that the quality of the runtime, something that we did not have in the past.

Currently this infrastructure is not shipping, but we will soon package it up and distribute it.

The compiler

Vbnc is a CIL compiler for the Visual Basic.Net language, written in Visual Basic.Net. The compiler is targeting the 2.0 version of the CIL language, and due to the implementation of the reflecion api in .NET it is currently impossible to generate 1.0 assemblies.

Compiler Status

The compiler is mostly feature-complete, with the following notable exceptions:

  • Default instances (this is planned to be done soon)
  • The support for late-binding, Option Strict Off / Option Explicit Off is very limited (this is much more work and will come gradually)
  • XML comments (no plans for this for the moment)

Installation

From Packages

Starting with Mono 1.2.3, packages of the Mono Visual Basic Compiler and Visual Basic Runtime are available at our Downloads page.

From Source Code

The code is currently available from SVN from the module mono-basic, alternatively a source code package is available from our Downloads page.

To install Mono Basic, use the usual:

   $ ./configure --prefix=/mono
   $ make && make install

Then you will be able to use vbnc as your command line compiler to build Visual Basic applications.

You need a recent version of Mono (1.2.3 will do).

FAQ for New Visual Basic Framework

What is The Mono Project announcing today?

The Mono project is announcing that it has developed a Visual Basic compiler that will enable software developers who use Microsoft Visual Basic to run their applications across multiple platforms without any modifications to the code. The new Mono Visual Basic compiler allows developers to continue to code in their preferred Visual Basic/Visual Studio environment and compile and run that same code base on a variety of operating systems and architectures, including Windows, Linux, and Mac OS.

What is the role of the compiler in the development process?

A compiler is a computer program that translates text written in a computer language (the source language) into another computer language (the target language). The most common reason for wanting to translate source code is to create an executable program. By creating the Visual Basic compiler, the Mono Project has developed a program, written in Visual Basic itself, that can translate Visual Basic language into computer language that will allow the application to be executable across across multiple platforms, including Linux.

Why is this new VB compiler important?

This is a milestone step forward in the Mono project. There are a huge number of developers worldwide who write using Visual Basic and this VB compiler makes it possible for those developers to write applications that run on Linux without needing any specific Linux expertise. Also, developers can now do Visual Basic development *in* Linux as opposed to using Linux only as a deployment target.

What's the difference between the earlier VB compiler and the one in 1.2.3?

Two pieces:

  • The runtime has been updated to contain many missing features (as part of our ongoing work using Moma, the Mono Migration Analyzer). This means that applications compiled on Windows would run on Mono.
  • Having a VB compiler is essential for ASP.NET support. Although binaries compiled with Microsoft's VB.NET compiler would run unmodified on Linux, it was not previously possible to use VB code in ASP.NET applications. Unlike other VB-based applications which can be pre-compiled in a Windows environment, ASP.NET has to be able to compile VB code found in ASPX files at runtime.

What are the uses of a native Visual Basic.NET compiler on Unix?

It allows:

  • Developers to develop applications natively on Unix.
  • Developers can continue to use Visual Studio on Windows and run the resulting binaries on Linux, allowing them to move their development to Unix when needed.
  • The hosting of VB.NET-based ASP.NET applications on Unix.

For which version of Visual Basic will this compiler work and when is it available?

The new Visual Basic compiler is an implementation of Visual Basic.NET version 8, so it has support for new features in the language such as generics. The current Mono 1.2.3 release (available from our Downloads page) includes the Visual Basic 8 compiler written in Visual Basic 8, and Mainsoft's Visual Basic runtime for 2.0. The compiler only targets the 2.0 framework API, while the runtime supports both 1.0 and 2.0 profiles.

If someone is using .NET 3.0, will this work?

.NET 3.0 is essentially a new set of libraries for .NET 2.0. We're working on some of these pieces right now, but we have not released any of this yet. The first one will be WCF, then followed at some point by WPF. So right now, if you're dependent on 3.0 APIs, you wont be able to port. But there are not many of these applications out there yet.

Is this part of the recent Novell-Microsoft agreement?

No. The Mono project is sponsored by Novell, but it is not part of the technical cooperation agreement announced between Novell and Microsoft in November 2006. Mono developers have been working on the compiler for some time. It is a significant technical achievement. Since it is open source, the technology is available for others to use.

Is the Visual Basic 8 compiler considered stable

We consider the compiler right now to be feature complete. That doesn't mean that it is bug free. Although there is enormous set of test suites that we run against it, people are still going to run into bugs, which they are encouraged to report at our Bugs page.

What about tools?

MonoDevelop v 0.13, available soon, will have VB support. MonoDevelop is available at our Downloads page.

Will applications compiled using the VB compiler in Linux (or Mac) run on Windows?

Yes, they will require .NET 2.0 to be installed.

Do applications compiled under Linux require the VB runtime to run?

Mono offers this as an option. Either you install Mono's Visual Basic runtime, or you can use a Mono process called "Bundling" that will generate a static executable with no external dependencies to run your binary.

Will there be a performance lag in compiling and running VB.NET apps on other platforms?

There are certain API calls that are Windows-specific which we have mapped to Linux, but the majority of applications do not depend strongly on Windows. The one bit that is not supported are COM components, since Linux has no equivalent to COM. If a Visual Basic application requires COM or ActiveX controls, those will not run.

How does the compiler fare as the size of the code increases?

It depends on the benchmark, on what is being tested and against which framework it is being tested. For example, you can look at some benchmarks run by the Debian group:

http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=csharp&lang2=java

The above URL looks at Mono vs Java, but you can pick and see Mono vs other frameworks/languages (notice that the one test where we are slower has been fixed, and we are now 20 times faster).

The Charles University in Prague also tracks the progress here:

http://dsrg.mff.cuni.cz/projects/mono/index.phtml

What's next on Mono's roadmap for cross-platform applications development?

This year we are looking to ship two major milestones:

  • ASP.NET 2.0 support
  • Windows Forms 2.0 support

These will bring a lot of new applications to Linux. We are currently tracking the progress of about 1,000 applications, libraries and components that have been submitted to Novell for porting. In addition, we will doing a preview of our 3.0 support: a C# 3.0 compiler with support for LINQ later in the year, and some of the new 3.0 and 3.5 APIs.

What is the overall goal of the Mono project?

The Mono Project is an open development initiative sponsored by Novell to develop an open source, UNIX-based version of the Microsoft .NET development platform. Its objective is to enable developers to build and deploy cross-platform .NET Applications. The project implements various technologies developed by Microsoft that have now been submitted to the ECMA for standardization.

Old Visual Basic Framework

For information about the old visual basic framework in Mono, see our Old Visual Basic page.