.NET Core vs Mono - c#
What is the difference between .NET Core and Mono?
I found a statement on the official site that said: "Code written for it is also portable across application stacks, such as Mono."
My goal is to use C#, LINQ, EF7 and Visual Studio to create a website that can be ran/hosted on Linux.
Someone told me that he wanted it to be "in Mono", but I don't know what that means. I know I want to use the .NET Core 1.0 with the technologies I listed above. He also said he wanted to use "fast CGI". I don't know what that means either.
Can you help me make sense of all these terms and if my expectations are realistic?
Necromancing.
Providing an actual answer.
What is the difference between .Net Core and Mono?
.NET Core now officially is the future of .NET. It started for most part with a re-write of the ASP.NET MVC framework and console applications, which of course includes server applications. (Since it's Turing-complete and supports interop with C dlls, you could, if you absolutely wanted to, also write your own desktop applications with it, for example through 3rd-party libraries like Avalonia, which were a bit very basic at the time I first wrote this, which meant you were pretty much limited to web or server stuff.) Over time, many APIs have been added to .NET Core, so much so that after version 3.1, .NET Core will jump to version 5.0, be known as .NET 5.0 without the "Core", and that then will be the future of the .NET Framework. What used to be the full .NET Framework will linger around in maintenance mode as Full .NET Framework 4.8.x for a few decades, until it will die (maybe there are still going to be some upgrades, but I doubt it). In other words, .NET Core is the future of .NET, and Full .NET Framework will go the way of the Dodo/Silverlight/WindowsPhone.
The main point of .NET Core, apart from multi-platform support, is to improve performance, and to enable "native compilation"/self-contained-deployment (so you don't need .NET framework/VM installed on the target machine.
On the one hand, this means docker.io support on Linux, and on the other, self-contained deployment is useful in "cloud-computing", since then you can just use whatever version of the dotnet-CORE framework you like, and you don't have to worry about which version(s) of the .NET framework the sysadmin has actually installed.
While the .NET Core runtime supports multiple operating systems and processors, the SDK is a different story. And while the SDK supports multiple OS, ARM support for the SDK is/was still work in progress. .NET Core is supported by Microsoft. Dotnet-Core did not come with WinForms or WPF or anything like that.
As of version 3.0, WinForms and WPF is also supported by .NET Core, but only on Windows, and only by C#. Not by VB.NET (VB.NET support planned for v5 in 2020). And there is no Forms Designer in .NET Core: it's being shipped with a Visual Studio update later, at an unspecified time.
WebForms are still not supported by .NET Core, and there are no plans to support them, ever (Blazor is the new kid in town for that).
.NET Core also comes with System.Runtime, which replaces mscorelib.
Oftentimes, .NET Core is mixed up with NetStandard, which is a bit of a wrapper around System.Runtime/mscorelib (and some others), that allows you to write libraries that target .NET Core, Full .NET Framework and Xamarin (iOS/Android), all at the same time.
the .NET Core SDK does not/did not work on ARM, at least not last time I checked.
"The Mono Project" is much older than .NET Core.
Mono is Spanish and means Monkey, and as a side-remark, the name has nothing to do with mononucleosis (hint: you could get a list of staff under http://primates.ximian.com/).
Mono was started in 2005 by Miguel de Icaza (the guy that started GNOME - and a few others) as an implementation of the .NET Framework for Linux (Ximian/SuSe/Novell). Mono includes Web-Forms, Winforms, MVC, Olive, and an IDE called MonoDevelop (also knows as Xamarin Studio or Visual Studio Mac). Basically the equivalent of (OpenJDK) JVM and (OpenJDK) JDK/JRE (as opposed to SUN/Oracle JDK). You can use it to get ASP.NET-WebForms + WinForms + ASP.NET-MVC applications to work on Linux.
Mono is supported by Xamarin (the new company name of what used to be Ximian, when they focused on the Mobile market, instead of the Linux market), and not by Microsoft.
(since Xamarin was bought by Microsoft, that's technically [but not culturally] Microsoft.)
You will usually get your C# stuff to compile on mono, but not the VB.NET stuff.
Mono misses some advanced features, like WSE/WCF and WebParts.
Many of the Mono implementations are incomplete (e.g. throw NotImplementedException in ECDSA encryption), buggy (e.g. ODBC/ADO.NET with Firebird), behave differently than on .NET (for example XML-serialization) or otherwise unstable (ASP.NET MVC) and unacceptably slow (Regex). On the upside, the Mono toolchain also works on ARM.
As far as .NET Core is concerned, when they say cross-platform, don't expect that cross-platform means that you could actually just apt-get install .NET Core on ARM-Linux, like you can with ElasticSearch. You'll have to compile the entire framework from source.
That is, if you have that space (e.g. on a Chromebook, which has a 16 to 32 GB total HD).
It also used to have issues of incompatibility with OpenSSL 1.1 and libcurl.
Those have been rectified in the latest version of .NET Core Version 2.2.
So much for cross-platform.
I found a statement on the official site that said, "Code written for
it is also portable across application stacks, such as Mono".
As long as that code doesn't rely on WinAPI-calls, Windows-dll-pinvokes, COM-Components, a case-insensitive file system, the default-system-encoding (codepage) and doesn't have directory separator issues, that's correct. However, .NET Core code runs on .NET Core, and not on Mono. So mixing the two will be difficult. And since Mono is quite unstable and slow (for web applications), I wouldn't recommend it anyway. Try image-processing on .NET core, e.g. WebP or moving GIF or multipage-tiff or writing text on an image, you'll be nastily surprised.
Note:
As of .NET Core 2.0, there is System.Drawing.Common (NuGet), which
contains most of the functionality of System.Drawing. It should be
more or less feature-complete in .NET-Core 2.1. However,
System.Drawing.Common uses GDI+, and therefore won't work on Azure
(System.Drawing libraries are available in Azure Cloud Service
[basically just a VM], but not in Azure Web App [basically shared
hosting?])
So far, System.Drawing.Common works fine on Linux/Mac, but has issues on iOS/Android - if it works at all, there.
Prior to .NET Core 2.0, that is to say sometime mid-February 2017, you could use SkiaSharp for imaging (example) (you still can). Post .net-core 2.0, you'll notice that SixLabors ImageSharp is the way to go, since System.Drawing is not necessarely secure, and has a lot of potential or real memory leaks, which is why you shouldn't use GDI in web-applications; Note that SkiaSharp is a lot faster than ImageSharp, because it uses native-libraries (which can also be a drawback). Also, note that while GDI+ works on Linux & Mac, that doesn't mean it works on iOS/Android.
Code not written for .NET (non-Core) is not portable to .NET Core.
Meaning, if you want a non-GPL C# library like PDFSharp to create PDF-documents (very commonplace), you're out of luck (at the moment) (not anymore). Never mind ReportViewer control, which uses Windows-pInvokes (to encrypt, create mcdf documents via COM, and to get font, character, kerning, font embedding information, measure strings and do line-breaking, and for actually drawing tiffs of acceptable quality), and doesn't even run on Mono on Linux
(I'm working on that).
Also, code written in .NET Core is not portable to Mono, because Mono lacks the .NET Core runtime libraries (so far).
My goal is to use C#, LINQ, EF7, visual studio to create a website
that can be ran/hosted in linux.
EF in any version that I tried so far was so goddamn slow (even on such simple things like one table with one left-join), I wouldn't recommend it ever - not on Windows either.
I would particularly not recommend EF if you have a database with unique-constrains, or varbinary/filestream/hierarchyid columns. (Not for schema-update either.)
And also not in a situation where DB-performance is critical (say 10+ to 100+ concurrent users).
Also, running a website/web-application on Linux will sooner or later mean you'll have to debug it.
There is no debugging support for .NET Core on Linux. (Not anymore, but requires JetBrains Rider.)
MonoDevelop does not (yet) support debugging .NET Core projects.
If you have problems, you're on your own. You'll have to use extensive logging.
Be careful, be advised extensive logging will fill your disk in no time, particularly if your program enters an infinite loop or recursion.
This is especially dangerous if your web-app runs as root, because log-in requires logfile-space - if there's no free space left, you won't be able to login anymore.
(Normally, about 5% of diskspace is reserved for user root [aka administrator on Windows], so at least the administrator can still log in if the disk is almost full. But if your applications run as root, that restriction does not apply for their disk usage, and so their logfiles can use 100% of the remaining free space, so not even the administrator can log in any more.)
It's therefore better not to encrypt that disk, that is, if you value your data/system.
Someone told me that he wanted it to be "in Mono", but I don't know
what that means.
It either means he doesn't want to use .NET Core, or he just wants to use C# on Linux/Mac. My guess is he just wants to use C# for a Web-App on Linux. .NET Core is the way to go for that, if you absolutely want to do it in C#. Don't go with "Mono proper"; on the surface, it would seem to work at first - but believe me you will regret it because Mono's ASP.NET MVC isn't stable when your server runs long-term (longer than 1 day) - you have now been warned. See also the "did not complete" references when measuring Mono performance on the techempower benchmarks.
I know I want to use the .Net Core 1.0 framework with the technologies
I listed above. He also said he wanted to use "fast cgi". I don't know
what that means either.
It means he wants to use a high-performance full-featured WebServer like nginx (Engine-X), possibly Apache.
Then he can run mono/dotnetCore with virtual name based hosting (multiple domain names on the same IP) and/or load-balancing. He can also run other websites with other technologies, without requiring a different port-number on the web-server. It means your website runs on a fastcgi-server, and nginx forwards all web-requests for a certain domain via the fastcgi-protocol to that server. It also means your website runs in a fastcgi-pipeline, and you have to be careful what you do, e.g. you can't use HTTP 1.1 when transmitting files. Otherwise, files will be garbled at the destination.
See also here and here.
To conclude:
.NET Core at present (2016-09-28) is not really portable, nor is is really cross-platform (in particular the debug-tools).
Nor is native-compilation easy, especially for ARM.
And to me, it also does not look like its development is "really finished", yet.
For example, System.Data.DataTable/DataAdaper.Update is missing...
(not anymore with .NET Core 2.0)
Together with the System.Data.Common.IDB* interfaces. (not anymore with .NET Core 1.1)
if there ever was one class that is often used, DataTable/DataAdapter would be it...
Also, the Linux-installer (.deb) fails, at least on my machine, and I'm sure I'm not the only one that has that problem.
Debug, maybe with Visual Studio Code, if you can build it on ARM (I managed to do that - do NOT follow Scott Hanselman's blog-post if you do that - there's a howto in the wiki of VS-Code on github), because they don't offer the executable.
Yeoman also fails. (I guess it has something to do with the nodejs version you installed - VS Code requires one version, Yeoman another... but it should run on the same computer. pretty lame
Never mind that it should run on the node version shipped by default on the OS.
Never mind that there should be no dependency on NodeJS in the first place.
The kestell server is also work in progress.
And judging by my experience with the mono-project, I highly doubt they ever tested .NET Core on FastCGI, or that they have any idea what FastCGI-support means for their framework, let alone that they tested it to make sure "everything works". In fact, I just tried making a fastcgi-application with .NET Core and just realized there is no FastCGI library for .NET Core "RTM"...
So when you're going to run .NET Core "RTM" behind nginx, you can only do it by proxying requests to kestrell (that semi-finished nodeJS-derived web-server) - there's no fastcgi support at present in .NET Core "RTM", AFAIK. Since there is no .net core fastcgi library, and no samples, it's also highly unlikely that anybody did any testing on the framework to make sure fastcgi works as expected.
I also question the performance.
In the (preliminary) techempower-benchmark (round 13), aspnetcore-linux ranks on 25% relative to the best performance, while comparable frameworks like Go (golang) rank at 96.9% of peak performance (and that is when returning plaintext without file-system access only). .NET Core does a little better on JSON-serialization, but it does not look compelling either (go reaches 98.5% of peak, .NET core 65%). That said, it can't possibly be worse than "mono proper".
Also, since it's still relatively new, not all of the major libraries have been ported (yet), and I doubt that some of them will ever be ported.
Imaging support is also questionable at best.
For anything encryption, use BouncyCastle instead.
Can you help me make sense of all these terms and if my expectations
are realistic?
I hope i helped you making more sense with all these terms.
As far as your expecations go:
Developing a Linux application without knowing anything about Linux is a really stupid idea in the first place, and it's also bound to fail in some horrible way one way or the other. That said, because Linux comes at no licensing costs, it's a good idea in principle, BUT ONLY IF YOU KNOW WHAT YOU DO.
Developing an application for a platform where you can't debug your application on is another really bad idea.
Developing for fastcgi without knowing what consequences there are is yet another really bad idea.
Doing all these things on a "experimental" platform without any knowledge of that platform's specifics and without debugging support is suicide, if your project is more than just a personal homepage. On the other hand, I guess doing it with your personal homepage for learning purposes would probably be a very good experience - then you get to know what the framework and what the non-framework problems are.
You can for example (programmatically) loop-mount a case-insensitive fat32, hfs or JFS for your application, to get around the case-sensitivity issues (loop-mount not recommended in production).
To summarize
At present (2016-09-28), I would stay away from .NET Core (for production usage). Maybe in one to two years, you can take another look, but probably not before.
If you have a new web-project that you develop, start it in .NET Core, not mono.
If you want a framework that works on Linux (x86/AMD64/ARMhf) and Windows and Mac, that has no dependencies, i.e. only static linking and no dependency on .NET, Java or Windows, use Golang instead. It's more mature, and its performance is proven (Baidu uses it with 1 million concurrent users), and golang has a significantly lower memory footprint. Also golang is in the repositories, the .deb installs without problems, the sourcecode compiles - without requiring changes - and golang (in the meantime) has debugging support with delve and JetBrains Gogland on Linux (and Windows and Mac). Golang's build process (and runtime) also doesn't depend on NodeJS, which is yet another plus.
As far as mono goes, stay away from it.
It is nothing short of amazing how far mono has come, but unfortunately that's no substitute for its performance/scalability and stability issues for production applications.
Also, mono-development is quite dead, they largely only develop the parts relevant to Android and iOS anymore, because that's where Xamarin makes their money.
Don't expect Web-Development to be a first-class Xamarin/mono citizen.
.NET Core might be worth it, if you start a new project, but for existing large web-forms projects, porting over is largely out of the question, the changes required are huge. If you have a MVC-project, the amount of changes might be manageable, if your original application design was sane, which is mostly not the case for most existing so-called "historically grown" applications.
December 2016 Update:
Native compilation has been removed from .NET Core preview, as it is not yet ready...
Seems like they have improved pretty heavily on the raw text-file benchmark, but on the other hand, it's gotten pretty buggy. Also, it further deteriorated in the JSON benchmarks. Curious also that entity framework shall be faster for updates than Dapper - although both at record slowness. This is very unlikely to be true. Looks like there still are more than just a few bugs to hunt.
Also, there seems to be relief coming on the Linux IDE front.
JetBrains released "Project Rider", an early access preview of a C#/.NET Core IDE for Linux (and Mac and Windows), that can handle Visual Studio Project files.
Finally a C# IDE that is usable & that isn't slow as hell.
Conclusion: .NET Core still is pre-release quality software as we march into 2017. Port your libraries, but stay away from it for production usage, until framework quality stabilizes.
And keep an eye on Project Rider.
2017 Update
Have migrated my (brother's) homepage to .NET Core for now.
So far, the runtime on Linux seems to be stable enough (at least for small projects) - it survived a load test with ease - mono never did.
Also, it looks like I mixed up .NET-Core-native and .NET-Core-self-contained-deployment. Self-contained deployment works, but it is a bit underdocumented, although it's super easy (the build/publish tools are a bit unstable, yet - if you encounter "Positive number required. - Build FAILED." - run the same command again, and it works).
You can run
dotnet restore -r win81-x64
dotnet build -r win81-x64
dotnet publish -f netcoreapp1.1 -c Release -r win81-x64
Note: As per .NET Core 3, you can publish everything minified as a single file:
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
dotnet publish -r linux-x64 -c Release /p:PublishSingleFile=true
However, unlike go, it's not a statically linked executable, but a self-extracting zip file, so when deploying, you might run into
problems, especially if the temp directory is locked down by group
policy, or some other issues. Works fine for a
hello-world program, though. And if you don't minify, the executable size will clock in at something around 100 MB.
And you get a self-contained .exe-file (in the publish directory), which you can move to a Windows 8.1 machine without .NET framework installed and let it run. Nice. It's here that dotNET-Core just starts to get interesting. (mind the gaps, SkiaSharp doesn't work on Windows 8.1 / Windows Server 2012 R2, [yet] - the ecosystem has to catch up first - but interestingly, the Skia-dll-load-fail doesn't crash the entire server/application - so everything else works)
(Note: SkiaSharp on Windows 8.1 is missing the appropriate VC runtime files - msvcp140.dll and vcruntime140.dll. Copy them into the publish-directory, and Skia will work on Windows 8.1.)
August 2017 Update
.NET Core 2.0 released.
Be careful - comes with (huge breaking) changes in authentication...
On the upside, it brought the DataTable/DataAdaper/DataSet classes back, and many more.
Realized .NET Core is still missing support for Apache SparkSQL, because Mobius isn't yet ported. That's bad, because that means no SparkSQL support for my IoT Cassandra Cluster, so no joins...
Experimental ARM support (runtime only, not SDK - too bad for devwork on my Chromebook - looking forward to 2.1 or 3.0).
PdfSharp is now experimentally ported to .NET Core.
JetBrains Rider left EAP. You can now use it to develop & debug .NET Core on Linux - though so far only .NET Core 1.1 until the update for .NET Core 2.0 support goes live.
May 2018 Update
.NET Core 2.1 release imminent.
Maybe this will fix NTLM-authentication on Linux (NTLM authentication doesn't work on Linux {and possibly Mac} in .NET-Core 2.0 with multiple authenticate headers, such as negotiate, commonly sent with ms-exchange, and they're apparently only fixing it in v2.1, no bugfix release for 2.0).
But I'm not installing preview releases on my machine. So waiting.
v2.1 is also said to greatly reduce compile times. That would be good.
Also, note that on Linux, .NET Core is 64-Bit only !
There is no, and there will be no, x86-32 version of .NET Core on Linux.
And the ARM port is ARM-32 only. No ARM-64, yet.
And on ARM, you (at present) only have the runtime, not the dotnet-SDK.
And one more thing:
Because .NET-Core uses OpenSSL 1.0, .NET Core on Linux doesn't run on Arch Linux, and by derivation not on Manjaro (the most popular Linux distro by far at this point in time), because Arch Linux uses OpenSSL 1.1. So if you're using Arch Linux, you're out of luck (with Gentoo, too).
Edit:
Latest version of .NET Core 2.2+ supports OpenSSL 1.1. So you can use
it on Arch or (k)Ubuntu 19.04+. You might have to use the .NET-Core
install script though, because there are no packages, yet.
On the upside, performance has definitely improved:
.NET Core 3:
.NET-Core v 3.0 is said to bring WinForms and WPF to .NET-Core.
However, while WinForms and WPF will be .NET Core, WinForms and WPF in .NET-Core will run on Windows only, because WinForms/WPF will use the Windows-API.
Note:
.NET Core 3.0 is now out (RTM), and there is WinForms and WPF support, but only for C# (on Windows). There is no WinForms-Core-Designer. The designer will, eventually, come with a Visual Studio update, somewhen. WinForms support for VB.NET is not supported, but is planned for .NET 5.0 somewhen in 2020.
PS:
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> /etc/environment
export DOTNET_CLI_TELEMETRY_OPTOUT=1
If you've used it on windows, you probably never saw this:
The .NET Core tools collect usage data in order to improve your
experience. The data is anonymous and does not include command-line
arguments. The data is collected by Microsoft and shared with the
community. You can opt out of telemetry by setting a
DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your
favorite shell. You can read more about .NET Core tools telemetry #
https://aka.ms/dotnet-cli-telemetry.
I thought I'd mention that I think monodevelop (aka Xamarin Studio, the Mono IDE, or Visual Studio Mac as it is now called on Mac) has evolved quite nicely, and is - in the meantime - largely usable.
However, JetBrains Rider (2018 EAP at this point in time) is definitely a lot nicer and more reliable (and the included decompiler is a life-safer), that is to say, if you develop .NET-Core on Linux or Mac. MonoDevelop does not support Debug-StepThrough on Linux in .NET Core, though, since MS does not license their debugging API dll (except for VisualStudio Mac ... ). However, you can use the Samsung debugger for .NET Core through the .NET Core debugger extension for Samsung Debugger for MonoDevelop
Disclaimer:
I don't use Mac, so I can't say if what I wrote here applies to FreeBSD-Unix based Mac as well. I am refering to the Linux (Debian/Ubuntu/Mint) version of JetBrains Rider, mono, MonoDevelop/VisualStudioMac/XamarinStudio and .NET-Core. Also, Apple is contemplating a move from Intel-processors to self-manufactured ARM(ARM-64?)-based processors, so much of what applies to Mac right now might not apply to Mac in the future (2020+).
Also, when I write "mono is quite unstable and slow", the unstable relates to WinFroms & WebForms applications, specifically executing web-applications via fastcgi or with XSP (on the 4.x version of mono), as well as XML-serialization-handling peculiarities, and the quite-slow relates to WinForms, and regular expressions in particular (ASP.NET-MVC uses regular expressions for routing as well).
When I write about my experience about mono 2.x, 3.x and 4.x, that also does not necessarely mean these issues haven't been resolved by now, or by the time you are reading this, nor that if they are fixed now, that there can't be a regression later that reintroduces any of these bugs/features. Nor does that mean that if you embed the mono-runtime, you'll get the same results as when you use the (dev) system's mono runtime. It also doesn't mean that embedding the mono-runtime (anywhere) is necessarely free.
All that doesn't necessarely mean mono is ill-suited for iOS or Android, or that it has the same issues there. I don't use mono on Android or IOS, so I'm in no positon to say anything about stability, usability, costs and performance on these platforms. Obviously, if you use .NET on Android, you have some other costs considerations to do as well, such as weighting xamarin-costs vs. costs and time for porting existing code to Java. One hears mono on Android and IOS shall be quite good. Take it with a grain of salt. For one, don't expect the default-system-encoding to be the same on android/ios vs. Windows, and don't expect the android filesystem to be case-insensitive, and don't expect any windows fonts to be present.
In the .NET world there are two types of CLRs, "full" CLRs and Core CLRs, and these are quite different things.
There are two "full" CLR implementations, the Microsoft native .NET CLR (for Windows) and the Mono CLR (which itself has implementations for Windows, linux and unix (Mac OS X and FreeBSD)). A full CLR is exactly that - everything, pretty much, that you need. As such, "full" CLRs tend to be large in size.
Core CLRs are on the other hand are cut down, and much smaller. Because they are only a core implementation, they are unlikely to have everything you need in them, so with Core CLRs you add feature sets to the CLR that your specific software product uses, using NuGet. There are Core CLR implementations for Windows, linux (various) and unix (Mac OS X and FreeBSD) in the mix. Microsoft have or are refactoring the .NET framework libraries for Core CLR too, to make them more portable for the core context. Given mono's presence on *nix OSs it would be a surprise if the Core CLRs for *nix did not include some mono code base, but only the Mono community and Microsoft could tell us that for sure.
Also, I'd concur with Nico in that Core CLRs are new -- it's at RC2 at the moment I think. I wouldn't depend on it for production code yet.
To answer your question you could delivery your site on linux using Core CLR or Mono, and these are two different ways of doing it. If you want a safe bet right now I'd go with mono on linux, then port if you want to later, to Core.
This is no more .NET Core vs. Mono. It's unified.
Update as of November 2020 - .NET 5 released that unifies .NET Framework and .NET Core
.NET and Mono will be unified under .NET 6 that would be released in November 2021
.NET 6.0 will add net6.0-ios and net6.0-android.
The OS-specific names can include OS version numbers, like net6.0-ios14.
Check below articles:
https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/
https://github.com/dotnet/maui
You have chosen not only a realistic path, but arguably one of the best ecosystems strongly backed(also X-platforms) by MS. Still you should consider following points:
Update: Main doc about .Net platform standard is here: https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md
Update: Current Mono 4.4.1 cannot run latest Asp.Net core 1.0 RTM
Although mono is more feature complete, its future is unclear, because MS owns it for some months now and its a duplicate work for them to support it. But MS is definitely committed to .Net Core and betting big on it.
Although .Net core is released, the 3rd party ecosystem is not quite there. For example Nhibernate, Umbraco etc cannot run over .Net core yet. But they have a plan.
There are some features missing in .Net Core like System.Drawing, you should look for 3rd party libraries
You should use nginx as front server with kestrelserver for asp.net apps, because kestrelserver is not quite ready for production. For example HTTP/2 is not implemented.
I hope it helps
.Net Core does not require mono in the sense of the mono framework. .Net Core is a framework that will work on multiple platforms including Linux. Reference https://dotnet.github.io/.
However the .Net core can use the mono framework. Reference https://docs.asp.net/en/1.0.0-rc1/getting-started/choosing-the-right-dotnet.html (note rc1 documentatiopn no rc2 available), however mono is not a Microsoft supported framework and would recommend using a supported framework
Now entity framework 7 is now called Entity Framework Core and is available on multiple platforms including Linux. Reference https://github.com/aspnet/EntityFramework (review the road map)
I am currently using both of these frameworks however you must understand that it is still in release candidate stage (RC2 is the current version) and over the beta & release candidates there have been massive changes that usually end up with you scratching your head.
Here is a tutorial on how to install MVC .Net Core into Linux. https://docs.asp.net/en/1.0.0-rc1/getting-started/installing-on-linux.html
Finally you have a choice of Web Servers (where I am assuming the fast cgi reference came from) to host your application on Linux. Here is a reference point for installing to a Linux enviroment. https://docs.asp.net/en/1.0.0-rc1/publishing/linuxproduction.html
I realise this post ends up being mostly links to documentation but at this point those are your best sources of information. .Net core is still relatively new in the .Net community and until its fully released I would be hesitant to use it in a product environment given the breaking changes between released version.
This question is especially actual because yesterday Microsoft officially announced .NET Core 1.0 release. Assuming that Mono implements most of the standard .NET libraries, the difference between Mono and .NET core can be seen through the difference between .NET Framework and .NET Core:
APIs — .NET Core contains many of the same, but fewer, APIs as the .NET Framework, and with a different factoring (assembly names are
different; type shape differs in key cases). These differences
currently typically require changes to port source to .NET Core. .NET
Core implements the .NET Standard Library API, which will grow to
include more of the .NET Framework BCL APIs over time.
Subsystems — .NET Core implements a subset of the subsystems in the .NET Framework, with the goal of a simpler implementation and
programming model. For example, Code Access Security (CAS) is not
supported, while reflection is supported.
If you need to launch something quickly, go with Mono because it is currently (June 2016) more mature product, but if you are building a long-term website, I would suggest .NET Core. It is officially supported by Microsoft and the difference in supported APIs will probably disappear soon, taking into account the effort that Microsoft puts in the development of .NET Core.
My goal is to use C#, LINQ, EF7, visual studio to create a website
that can be ran/hosted in linux.
Linq and Entity framework are included in .NET Core, so you are safe to take a shot.
To be simple,
Mono is third party implementation of .Net framework for
Linux/Android/iOs
.Net Core is microsoft's own implementation for same.
.Net Core is future. and Mono will be dead eventually. Having said that .Net Core is not matured enough. I was struggling to implement it with IBM Bluemix and later dropped the idea. Down the time (may be 1-2 years), it should be better.
This is one of my favorite topics and the content here was just amazing. I was thinking if it would be worth while or effective to compare the methods available in Runtime vs. Mono. I hope I got my terms right, but I think you know what I mean. In order to have a somewhat better understanding of what each Runtime supports currently, would it make sense to compare the methods they provide? I realize implementations may vary, and I have not considered the Framework Class libraries or the slew of other libraries available in one environment vs. the other. I also realize someone might have already done this work even more efficiently. I would be most grateful if you would let me know so I can review it. I feel doing a diff between the outcome of such activity would be of value, and wanted to see how more experienced developers feel about it, and would they provide useful guidance. While back I was playing with reflection, and wrote some lines that traverse the .net directory, and list the assemblies.
Related
How to use OS-specific procedures on .NET Core 2 program?
I'm really interested in using .NET Core 2.x to write multiplatform programs in C#. I'm already into an experiment where I monitor and control processes using System.Diagnostics.Process. That said, I believe I'm already working on a critical use-case, since it may be easy to require system-specific procedures that .NET Core still can't expose to the developer. It is still a concern without any practical case, but I'm thinking of tasks like: Getting the number of physical+logical processors (on Windows, one should use WMI, that I don't believe it is available in .NET Core to do the same on MacOS/Linux). Creating the memory dump of a crashed Process (OS-specific calls may be needed?) In general anything that it is usually accomplished by C++ calls that are native to a specific OS So I'm wondering how to approach these "future" issues. Is .NET Core / C# still a valid solution for my needs? Or is there a way to invoke OS-specific calls on a .NET Core 2.x project? Note: for external reasons, I'm currently limited to use .NET Core 2.x branch, not 3.x.
Until you won't plan to use any MS GUI frameworks (Windows Forms, WPF, UWP), .NET Core can be a flexible and viable option on platforms other than Windows too. One can use p/invoke to gain access to native methods, that should be working with .NET Core running on Unix-like systems too, although only the system-specific libraries will be available on each OS. The RuntimeInformation.IsOSPlatform method and the conditional compilation symbols also can be used to branch the code for specific OSes. Others already have an answer on how to get a dump from a .NET Core application.
Migration from .NET framework 2.0 to 4.5.2
We have an application with around 300+ components (dll's and a couple of exe's). Some of them target 4.0 framework, some use 2.0 framework, some are written in native C++ (unmanged), some uses C++/CLI and a couple of them are written in ManagedExtensions for C++. Now our requirement is to migrate to .NET Framework 4.5.2. So my question is: Will it be OK if I just change the TargetFramework version on all the exe's to 4.5.2 with out changing the dll's TargetFramework version? Does it guarantee that all my dll's are loaded and run in 4.5.2 runtime? (Included all the C++ dll's). I have gone through multiple articles on internet and I could not find a concrete answer in the scenario where we have a mix of C#, managed c++ and unmanaged c++ dlls. Any help is appreciated. Edit: Our team generate core libraries (sort of a framework) and few executables (targetted to 2.0 framework) which can be used by various other teams to meet their customer specific requirements. Some of the customers are not yet migrated from XP (Max .NET framework used in XP is 4.0). So along with newer OS's we still need to support clients using XP.
While 2.0 projects are generally upgradable to 4.5.x with no code changes, there are breaking-differences between .NET versions that you may run into. Given the scale and complexity of your project I must advise against blindly changing the TargetFramework property and hoping for the best. While 4.0 executables can load 2.0 DLLs, it is not recommended because of the breaking-changes I described. You will run into problems with the mixing of C++ code. I recommend you start by upgrading (or rather, rewriting) your "Managed Extensions for C++" code to C++/CLI (you might want to take advantage of C++11 and C++14 features present in VS2015 while you're at it). I recommend upgrading each project individually and separately, working your way up the dependency-chain. It will help if you have (or will write) unit tests and integration tests for more critical parts of your system.
Migrating from 2.0 to 4.5.2 is just click click job, whereas no gaurantee thay it wont break anything. Recently I upgraded a webapplication to 4.5.2 and there were requestvalidation issue,3rd party tool broke and what not. So one cannot say it will work seamlessly, you have to test it out to see if it works. Now mixing 2.0 with 4.5.2 may cause chaos as you need to take into account consuming application too at the time of writing code.
Running C# application with .NET - MONO
I have a simple application made using C#. Now how do I make it , such that it runs on all systems. If a PC does not have .NET framework installed - it shouldsiliently install it with only the bare minimum requirements that the program needs. Installing .NET framework - too big in size compared to many program , which is just a few kilobytes. Also is shoulf be silent and only if required. Basically the application should be light and capable to run in all Windows systems. Not interested in getting to Linux users. Should I use Mono Project. Else is there a way to get the bare minim .NET framework selectively pre-installed. Please advise. Thanks
Have a look at mkbundle. It will create a standalone executable, with no other dependencies. In particular it does not need neither the Mono runtime nor .NET to be installed in order to execute. The size might still be a problem (it will likely be several megabytes, even compressed), so there is another tool to strip out everything you don't need from the assemblies: the monolinker. Note that the size will likely not reach the kilobyte range even after doing all this.
You can do this with a lot of work and the help of the Mono framework. See Embedding Mono for more information. All that considered, it would be much easier to use a boostrapper to get a version of the .NET Client Framework installed. But you're going to lose the ability to install silently or be in the "kilobytes" footprint.
Unfortunately you cant run a .NET program on a machine that does not have the .NET framework installed and the installer of the program could be made to download the framework automatically but not in .NET .
To run .net applications you need the .net framework installed, that should be either the full version or the limited client profile edition. The easiest way is to create a setup project from VS and require the .net version you want... the installer should be able to install the .net framework from the internet so you are not required to ship it with the app, which you can do by the way from the installer. Mono won't be different since it still needs to be installed on the system. Mono however has full AOT support, but I don't have any idea whether that would help you or not... it is still a huge overkill anyway. If you need your app to be small and run on ANY windows without any dependencies, you should do in c/c++ or vb6 whose runtime ships with most windows versions.
Deploying c# app - user need to install .net framework?
Hey guys - I just wrote an app using c# and ready to deploy it. Never deployed a c# app before. I deployed it and VC# outputted a .application file, application folder, and an installer. One of my users ran the installer (Windows 7) and was prompted to download/install the .net framework - which took upwards of 10 minutes. This is not acceptable for how simple my app is. Moreover, I will need this app to be able to run on mac osx and linux if possible. Should I have wrote this in Java instead (poor planning on my part). What are my options?
C# is compiled to bytecode that runs on the CLR, the virtual machine that's at the core of the .NET framework. So yes, you need the .NET framework to run that. Most current versions of Windows (XP, Vista, 7, etc.) come with some version of the .NET framework pre-installed, so your users don't have to download and install it. However, you might have used a version that's not already installed on the computers of (some of) your users. For Linux and Mac OS X there is Mono, which is an open source implementation of .NET, but it does not contain everything that Microsoft's .NET contains, so your program might not work fully on Mono. Using Java is not a real solution in the sense that your users would need to download and install the JRE (Java Runtime Environment) to run Java programs, very similar to the .NET framework. An advantage if you'd have used Java, is that Java is much more cross-platform compatible than .NET (Microsoft has no real interest in making .NET run on anything else than Windows).
.NET apps require the .NET framework. Java apps require the JRE. Your app is simple because .NET has done a lot of the work for you. A lot of companies write desktop apps in C++, but you will have to be mindful of cross-platform issues.
Yes, with any language that compiles to run on a managed runtime (.NET or Mono CLR, Java JVM) you will need to have that runtime installed. A C# application can compile to run on Windows on the .NET CLR, or on all the platforms you mention to run on the Mono runtime instead. Alternatively, a Java application would compile to run on the Java JRE, which is also compatible with all the platforms you mention. So with either language there is potentially this extra installation overhead, and with either language you can achieve what you want.
You'll need to have .NET installed on your client's system in order to use your application. As for running cross-platform - depending on how your Application is written, this can be simple or difficult. You may want to look at Silverlight. This is directly supported on OS X and works on Linux via Moonlight. Another alternative is to use Mono to run your .NET application on other platforms.
A C# app will need an implementation of the CLR (.NET) running on the local machine in order to run. A Java app will need an implementation of the JVM so it is really no different. On Windows, I would expect most people to have a .NET install. Take a look at the Mono project as far as running it on Linux and Mac: http://mono-project.com/Main_Page One thing you can consider is using an older version of the .NET framework to ensure that the greatest number of people have it installed. I would use .NET 3.5 or even 2.0 if you do not need fancy new features. That would have been installed already on Windows 7 for example. Since the Windows 7 user had to download the framework I assume you are currently targeting .NET 4 which means you must be using Visual Studio 2010 (or an express version). Here is a link that tells you how to target a different version of the framework: http://msdn.microsoft.com/en-us/library/bb398202.aspx One quick note about Mono, it is an excellent cross-platform option but it does not support the Windows Presentation Foundation (WPF) GUI framework at this point. You will either have to use Windows Forms or create different front-ends for different platforms. If you want to create a Linux GUI (also available on Windows and Mac) you can try GTK#: http://www.mono-project.com/GtkSharp For a Mac native GUI you can check out MonoMac: http://mjhutchinson.com/journal/2010/06/09/monomac_in_monodevelop An excellent IDE for cross-platform .NET development is MonoDevelop (it will read your VC# project files): http://monodevelop.com/
Like Java, .Net languages need a runtime installed. The full .Net framework is sometimes too big for small applications, so there is a smaller version of it call the compact framework with a smaller footprint that will install and download faster. You can read about it at http://msdn.microsoft.com/en-us/netframework/aa497273.aspx. As noted by other answers most current versions of Windows come with various versions of .Net framework, so this installation may not be needed for every user. As far as your cross platform needs go Mono allows for running .Net applications on Linux, I am not sure about running them on OSX. My assumption is you can not. Unfortunately your cross platform requirements made .Net a bad choice, and you should have gone with Java.
Other people gave you complicated answers. Well here's my simple answer. .NET framework is needed to run .NET applications and so do Java need JVM (as MCain said). Starting with Windows Vista, Microsoft includes .NET Framework built inside Windows. And in addition, .NET have versions, from 1.0 to 4.0. With Vista and Windows 7, .NET 3.5 is installed by default. I think your app is targeted for .NET 4.0 which is why a Windows 7 user needed to install .NET framework. For me, if I have to write a simple program, I'll use .NET 2.0 (later version = larger libraries, etc) so that my users (if they are Vista or Windows 7) don't have to install .NET again to run my software. You can choose which version of .NET you will target from New Project Window in Visual Studio.
You can change the target framework in the properties tab. If you start a project in VS2008 the default is .net 3.5 and for VS2010 it is .net 4.0. If you don't need the advanced features you can change your target back to 2.0 which should be available on most computers by now (I would guess far over 90%). Be sure to remove dependencies which are not available in 2.0 (like System.Linq, System.DataSet.Extensions) and the accociated imports (But the compiler will tell you what to do).
How to run C# project under Linux
Do you know any ways to run a C# project under Linux. Are there any framewoks or libraries for this?
You're looking for the Mono Project - a cross-platform (but primarily targeted at Linux) implementation of the .NET Framework and CLR. It's capable of running binaries compiled for the CLR (MS .NET), or of creating its own native Linux binaries. The project has been going a while now, and it's current version (2.4) is very usable, even for production purposes. See the project roadmap for details of the main features and milestones of current and future releases. Details about the current state: The great majority of the BCL (Base Class Library) is available on Mono, with the exception of some of the .NET 3.0/3.5 stuff, such as WPF (which has minimal support currently) and WCF (almost non-existent support). Silverlight 2.0 is however being supported via the Moonlight project, and progress on that is going well. WinForms functionality (which uses GTK# as a backend) is however quite complete, as far as I know. Implementation of the C# 3.0 language is effectively complete, including the C# 3.0 features such as lambda expressions, LINQ, and automatic properties. I believe the C# compiler is mature to the point that its efficiency is at least comparable with that of the MS compiler, though not yet matching it in some respects. What's quite cool (and unique) about the Mono C# compiler is that is now offers a compiler service - in other words true dynamic compilation from code (without using the CodeDOM). This is something that MS will perhaps only add in .NET 5.0.
Like others have already said, you can run .NET applications on Mono. If your applications use Platform Invocation (P/Invoke) to call native code, you may run into some trouble if there is no Mono implementation of the native library. To check whether your application does that (or uses APIs that haven't been implemented in Mono yet), you can use the Mono Migration Analyzer (MoMA).
For those who come across this question post 2016, can use .NET Core - An open-source, general-purpose development platform maintained by Microsoft and the .NET community on GitHub. It's cross-platform (supporting Windows, macOS, and Linux) and can be used to build device, cloud, and IoT applications.