Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Older version of .Net not installed with latest Mono?

I've been working on a .NET 3.5 C# project using Visual Studio Community 2015, but I had always intended to do most of the development on Linux (Ubuntu Gnome 15.04) using Mono and MonoDevelop.

I'm running the latest stable Mono release (4.0.4) and MonoDevelop (5.9.6), which supports .NET 4.5 and can open the VS created solution file without issue.

Now I've been writing C++ apps on Linux for the best part of a decade, but C# and .NET are completely new to me. So I assumed that if I installed a Mono version that supports .NET 4.5, I would get .NET 3.5 as well because the later version is a superset of the older - much like a C++14 compiler supports C++03.

However this doesn't seem to be the case, as MonoDevelop states (under the Target Framework option for each project):

  • .NET Framework 4.5.1
  • Mono / .NET 4.5
  • Mono / .NET 3.5 (Not installed)

So do I have to install a parallel older version of Mono in order to get .NET 3.5 support, or am I just suffering a configuration problem?

like image 946
cmannett85 Avatar asked Oct 17 '15 10:10

cmannett85


People also ask

What version of .NET does Mono support?

The easiest way to describe what Mono currently supports is: Everything in . NET 4.7 except WPF, WWF, and with limited WCF and limited ASP.NET async stack.

Can Mono run .NET framework?

Yes, Mono can run applications developed with the Microsoft . NET Framework on UNIX.

What is the difference between .NET and Mono?

NET is platform dependent, Mono allows developers to build Linux and cross- platform applications. Mono's . NET implementation is based on the ECMA standards for C#. This paper examines both of these programming environments with the goal of evaluating the performance characteristics of each.


3 Answers

No configuration issue, Mono dropped support for the older frameworks in the 4.x release. If you need to compile against the 3.5 assemblies, then yes, you will need a parallel install.

Dropped Support for Old Frameworks

Reference Assemblies

We no longer build the reference assemblies for the .NET 2.0, .NET 3.5 or .NET 4.0 APIs, we now ship binaries of the reference assemblies (API contracts, without any actual executable code in them).

Mono will now only build the .NET 4.5 assemblies as well as the mobile-based profiles.

Note: You can still run assemblies compiled for earlier .NET profiles on Mono, there’s no need to recompile them (they’ll just run on the .NET 4.5 assemblies instead).

like image 50
SushiHangover Avatar answered Oct 21 '22 16:10

SushiHangover


I had a similar issue (project targeting .NET 4.0, but now only 4.5 is available through mono). My workaround was to create a symlink for 4.0:

On my Fedora 32 machine this was done by

cd /usr/lib/mono
sudo ln -s 4.5 4.0

This is supposed to work because there a (almost) no breaking changes between .NET 4 and 4.5 - YMMV

like image 28
ChriPf Avatar answered Oct 21 '22 16:10

ChriPf


Finally, Got it to work. I'm using Visual Studio for Mac - https://www.visualstudio.com/vs/visual-studio-mac/

Under Preferences->Projects->.Net Runtimes you can change the Default .Net Runtime. It defaults to Mono 4.8.0.

This is located here on a mac : /Library/Frameworks/Mono.framework/Versions/4.8.0

From here you can download older versions of Mono https://download.mono-project.com/archive/

I downloaded 3.12.1 from https://download.mono-project.com/archive/3.12.1/macos-10-x86/ and copied it into the /Library/Frameworks/Mono.framework/Versions/ folder.

Within VisualStudio you can then add the .net framework and set it as default. My project then compiled.

like image 26
Emile Avatar answered Oct 21 '22 15:10

Emile