Develop ASP.NET Core application in Windows and Mac - c#

.NET Core is cross-platform in that you can develop and run an application on your desired platform (Mac, Linux, or Windows). However, I can't find any information on cross-platform development of an application, in particular, of an ASP.NET Core application.
We are building a new website and we need to be able to have some users work on an ASP.NET Core application on Windows and some on Mac. (There is currently no need to support development on Linux.) On the Windows side, we would ideally like to work in VS 2015 (Community).
Is this possible? If so, are there any required or recommended steps to follow or workarounds to help make the process smoother? Are there any limitations to this approach?

The official documentation has everything you need to get started https://learn.microsoft.com/en-us/aspnet/core/tutorials/your-first-mac-aspnet
Update: For Visual Studio instructions: https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/

Related

Porting WinForms app on mac or just develop it again?

I've developed a WinForms application with C# in Visual Studio on Windows and I need a version for macOS but I don't know which way is the best.
I also have a Mac machine so don't have problems about the compiler: I already used VS2017 with integrated Xamarin to develop an iOS app using my mac as the required build server but didn't find any such method for developing a Mac desktop application. NET core only works with console application and even Visual Studio for Mac is different from Visual Studio for Windows and doesn't provide any visual designer. Am I forced to redo the whole application using an Apple product?
There are multiple solutions to building desktop apps targeting a Mac using .NET.
Mono is an alternative implementation of the .NET Framework that reimplements the underlying Windows API calls that Win Forms makes. It's probably the most straightfoward way to port an existing Win Forms app to Mac.
ElectronNET is a combination of Electron and .NET. Electron provides a desktop development framework combining a Chromium rendering engine with NodeJS. It's best if you have a lot of familiarity with web development. It's notable that major companies that want to build cross platform apps are using Electron (Visual Studio Code, Slack, Atom etc) so those with the time to invest in researching how to do a cross platform app seem to choose this option.
Avalonia is a .NET desktop framework that is inspired by WPF, but it's cross platform.
So no, you aren't forced to redo your application. Hopefully you've done a good job of separating UI logic from business logic, which will make using one of these other technologies easier.
Note that even though .NET Core 3 (which is cross platform) has support for Win Forms and WPF, that functionality will only be working on Windows. Win Forms still depends on the underlying Windows APIs, and WPF still depends on DirectX.

Can you develop Linux applications with Xamarin?

Is it possible to develop and build Linux applications with Xamarin with the same code base?
After a few years with Ubuntu, my main OS right now is Windows again. But it's not impossible that I could switch to Mac.
Right now I have a bit of experience with Qt and no experience with Xamarin.
With Qt you can develop on Windows, Linux, and Mac and for Windows, Linux, Mac, iOS, Android, Windows Mobile, ... They are pretty clear about that.
Since Xamarin is free and open source now and I still don't have much experience in Qt, I'm considering trying out Xamarin for cross platform development instead of Qt.
Not being able to release my software for Linux would be a deal breaker for me. Being able to develop on Linux would be nice, but is optional.
But after all my Google research, I could only find information and people asking for support to develop on Linux and not for Linux.
As far as I know, this shouldn't be a problem with Mono alone. But as far as I know Xamarin > Mono and I don't get everything in Mono I could get in Xamarin.
I'm also not sure how well-supported Mono will be in the future. For me it looks like Xamarin is much more important for Microsoft than Mono itself.
I'm not sure if it's even possible, since Xamarin is based on Mono, but is it possible that Microsoft will at some point decide not to support Mono with .NET compatibility in the same way as Xamarin, or even cancel Mono as standalone completely?
So I'm looking for one single framework for all desktop and mobile platforms I can rely on, and I want to know if Xamarin and/or Mono and and/or Xamarin + Mono could be an alternative to Qt before I go deeper into any of those solutions.
Just in case someone else comes accross this q/a: the situation has changed. With Xamarin.Forms 3.0, Gtk# is supported (as preview, at this moment). Therefore, full Linux GUI support is enabled.
So, Xamarin now covers:
Android
iOS
UWP apps
WPF apps
Linux Gtk desktop applications
Mac OS
Watch OS
tv OS
Tizen
The only thing left to wish for: JS/HTML5 Web App target platform, as part of Xamarin :)
No, Xamarin is not available for Linux. This was a conscious decision made by the Xamarin team several years ago:
Miguel de Icaza 2011-08-04 11:52:37 UTC
We face a QA problem here.
The problem with supporting Linux is that we would need to create a
self-contained Mono packaging for all of the bits we ship since most
Linux distributions are slightly off when it comes to Mono.
It also means that if we advertise "Linux" we would need to QA a dozen
different combination due to different Linux distributions and
different editions of each distribution.
Perhaps we would support just a single distribution and a single
version, which is closer to what we have to do on Windows/Mac today.
To clarify, the Xamarin product range is not available on Linux (Xamarin Studio, Xamarin.iOS and Xamarin.Android) but MonoDevelop, the foundation of Xamarin Studio, and Mono, the cross-platform .NET runtime, definitely is.
You can build desktop software using MonoDevelop. The MonoDevelop site has plenty of instructions on getting started:
Install MonoDevelop on Linux
Seems that there is a chance of Xamarin Forms work on linux distros. In this reddit thread Miguel de Icaza says:
Some of our team members actually develop in Linux. The reason why we
never released the Linux tools is because we were charging a lot of
money and people would rightfully expect the software to be fully
supported. We had enough keeping our Mac and Windows users happy, and
adding an unknown number of Linux distributions sounded like a hard
task. Now that we are open sourcing the SDKs and I no longer will feel
bad if something does not work under a particular Linux configuration,
I will be happy to release the Linux builds.
That is: the fact that Forms is an open source tool currently opens this possibility.
Yes, as of mid-2018, it is possible to develop cross platform GUI applications that target windows/mac/linux/android/ios using the "Xamarin.Forms" library. Basically, you have one shared library project from cross platform code (UI and other cross platform stuff), and one project per platform for platform-specific code (Xamarin.Forms have one backend implementation for each platform. On Linux, this is using GTK).
However, with MonoDevelop you can only develop/build the cross-platform project and the linux-specific project of the application. You will still need to use Visual Studio or Rider to develop/build for the other platforms.
See the following answer:
https://stackoverflow.com/a/53317021/298005
https://github.com/0xFireball/xamarin-android-linux
As matthewrdev said, Xamarin.Studio, Xamarin.iOS, and Xamarin.Android aren't "officially" supported; however, Xamarin.iOS uses virtual emulator anyway (and I don't think there will be a workaround for Xamarin.iOS to run on Linux), but for Xamarin Studio (MonoDevelop on Linux, or Jetbrain's Riders (how to run it on linux with no official support is also provided in the link) Can run on Linux as an alt for Xamarin.Studio, and that link I shared explains how to install Xamarin.Android on linux, so just for Xamarin.iOS you will need to migrate or dual boot or sth, I hope that helps! (I stopped using Xamarin my-self, however, this environment helps developing for Xamarin on linux!)
GTK is listed as one of supported platforms/backends for Xamarin.Forms which allows building apps for Linux (as well as macOS and Windows via same GTK project). Though it doesn't look like there was much of development since 2018/2019 and Xamarin.Forms 3.0. Tried running 2 apps with basic UI and compared GTK backedn on Windows/macOS (comparing to WPF and Xamarin.mac back-ends ) and found GTK not worth pursuing (basic scenarios failing).
You can track GTK progress at https://github.com/jsuarezruiz/forms-gtk-progress/blob/master/Status.md
On Ubuntu 20.04, you can run your ASP.Net MVC 5 application using XSP4. Open a console to where you installed your MVC applications, where all folders, Global.asax, Web.config, ... are and run "xsp4 --port 80" or any other port you like and available. XSP4 is an independent web server and does not need Apache to be run.
Also, for C# developers, even the MonoDevelop is not in Ubuntu 20.04, which I don't know why, you can still install it and debug your ASP.Net MVC application. You can also debug any WinForm and console application using the MonoDevelop. YOu can run all your application using mono too.

ASP.NET 5 developing on Windows but running on Linux

Since ASP.NET 5 can run on both Windows and Linux :
Is it possible to develop on Windows and then deploy on a Linux machine?
Does the "publish" in visual studio for MVC project still work in that scenario?
Yes, so long as you don't do anything platform specific (ex: Linux has no Registry) and you develop for .NET Core
It depends on what type of publish. But even then, you don't have to limit yourself to what VS can do. You can write your own publish scripts if you want.

How to develop cross platform mobile application using Visual Studio

May be this is a question when a programmer/developer thinks to start mobile application development. But he is habitual of a particular environment in which he is working from several years. So it would be more comfortable that he can develop mobile app in the same environment what he is using from years.
I am currently working in Asp.Net MVC with C#, Visual Studio 2013 and i like it most. I am working on a large MIS and want to make available my solution to all platforms. As we know mobile devices are the most powerful technology current days.
Please suggest some way that i can work in visual studio and can develop cross platform mobile application that can work on Android, MAC, Windows Mobile and Windows PC/Laptops
I know there is many tools are available, but i need an expert suggestion on this particular scenario. If you provide a solution then please describe how to enable it in visual studio or how to customize current solution for that.
To have .net apps running on mobile platforms other than microsoft, have a look at xamarin
This is the front office for the mono framework
I know it's probably old question but you can try Apache Cordova with Visual Studio.
More options described in here

can we deploy an asp.net web application developed in windows in ubuntu

We have developed a web application in windows using visual studio 2005. Is it possible to deploy that application in linux using crossover. Is it possible to run crystal reports in asp.net using crossover.
I have used wine, and cross over and even mono. But it was not possible for me to develop crystal reports web application in ubuntu.
But I am able to develop windows application using c# with mysql database as backend and have used crystal reports. But it doesn't work for ubuntu
Please look at the below posts for more details:
how to run crystal reports in ubuntu linux
Can't connect to MySQL for .NET application deployed in Wine using Ubuntu
http://www.talkonsomething.com/2009/11/how-to-connect-mysql-database-from-windows-xp-to-ubuntu/
Yes.
Well, maybe.
You will probably have more luck with Mono than wine, but either way you're looking for pain.
Good luck.
You can now install visual studio code in Linux and compile it there. Microsoft's Visual Studio Code is an Integrated Development Environment (IDE) with support for Mac, Linux and Windows.
As Shoham mentioned, Microsoft recently released Visual Studio Code, a lightweight, cross platform code editor. However, this doesn't exactly get you all the way to fully deploying .NET code on Ubuntu. In order to do that you also need to install the CoreCLR and the ASP.NET 5. I've been trying to do exactly this in OS X, which should be very similar, but haven't quite gotten it working yet.

Categories

Resources