Developing an ASP.NET Core project on Ubuntu

It's a long time that I'm trying to migrate from Windows/.Net to Linux. But job market have more demands on .Net other than none Microsoft technologies. My hope was on ASP.NET Core. It was not very good at the Beta/RC time but now that is published in final version, my mind has been changed. It now works good on Ubuntu.

 

At start I created several test projects with ASP.NET Core on both Windows and Ubuntu. I wanted to be sure that ASP.NET Core is capable enough to rely on it in a real world project. I tried to test all aspects of MVC, Web API, Razor, Nuget packages, EF Core, Identity Core, internal DI/IoC, project.json, SQLite, unit testing and tooling include Visual Studio Code, debugging, unit testing, auto complete, code formatting, shortcuts, etc. I tested them on a Windows machine and on an Ubuntu machine with both Unity and Xfce desktops. All tests showed that I will not encounter a big problem utilizing ASP.NET Core itself as first place and using it in Ubuntu at second place.

 

Using .Net Core in Ubuntu is as same as Windows except that you rely more on terminal than GUI. Using dotnet commands are exactly same in both Windows and Ubuntu. Same names, same switches, same operations and same outputs. It was really good thing that they are exactly same. But when it comes to tooling it is different. While your IDE in both platforms is Visual Studio Code they do not differ very much but if you are used to use Visual Studio 2015 then you can understand how deep is difference between Visual Studio Code and Visual Studio 2015. The latter have a full integration and do everything you need with just pressing some shortcuts. But Visual Studio Code needs many configurations to behave like Visual Studio 2015. Debugging in Visual Studio Code is not as easy as Visual Studio 2015, you need some level skill of operating system to be able to debug codes in Visual Studio Code. My good friend from Visual Studio 2015, IntelliSense, was not working at all at first days. Now that it works, it does not work as good as in Visual Studio 2015. It shows many un-related items too. BTW having Visual Studio Code in Ubuntu is like a miracle. It is very similar to Visual Studio 2015, it has code highlighting, similar shortcuts (Unity desktop), good integration with git, real time compile (to show errors in the code), etc. Did I mentioned that you can use yeoman as a substitution of Visual Studio 2015 templating system that is absent in Visual Studio Code?

 

The project I am working on it in Ubuntu is a regular web application with parts rendered via MVC and parts delivered to a mobile app as Web API. In development environment I use SQLite as database backend but for production we will be using MS-SQL Server. EF Core works good despite its constraints in verison 1. SQLite in other part also works good as development environment database. It does not allow complete support of EF migration but instead works same from Ubuntu and from Windows. One thing that works great is that the code I'm working on is working exactly same in Windows and Ubuntu. I change code in my Ubuntu machine, commit and push them to the server then pull it from a Windows machine and then continue my development from my Windows machine, no matter I have switched from one OS to another OS. Code behaves same in both OSes and runs exactly same. Additionally code can be developed and run in both Visual Studio Code and Visual Studio 2015 as same. The only consideration is directory structure be designed compatible with structure that Visual Studio 2015 knows about.

 

I haven't yet deployed the project into a Linux machine as our client probably prefer to use Windows for it. But I hope hosting would not be a problem too. As a long term .Net developer I am very exited about cross platform feature that Microsoft has been added to .Net but frankly I'm a bit worry about it. I'm not sure if Microsoft would continue this way on Linux or not. I am afraid that developers using .Net in Linux would not be as big as Microsoft imagines then abandon it.

 

I started developing ASP.NET Core on Ubuntu on Unity (standard desktop with Ubuntu). Everything was good except high CPU usage. This problem was not caused by ASP.NET Core instead it was caused by 'hud service' from Unity. For this reason I decided to try Xfce also. It is a light desktop that does not have hud service high CPU usage problem but have problems of its own kind. First thing you encounter is that shortcuts are very very different than Unity. I lost even my Ctrl+F3 (for searching keywords in Visual Studio Code). In rare situations it has problems with high CPU usage of Visual Studio Code (OmniSharp) but bigger problem is regular crashes of my applications like Toggl, my favorite time tracker, and even Google chrome. Though I'm still using Xfce but think I would soon switch back to Unity and find another solution for hud service high CPU usage.

 

Please see some pictures of my experiences:

asp-net-core-debug-ubuntu-xfce omni-sharp-high-cpu-usage xfce-chrome-crashes

 

Entire family goes Ubuntu

We have a dual boot PC in our home. It has Ubuntu 15.10 and Windows 10 on it. My occasional usage of this PC is done with Ubuntu. Our 5 years old son uses Ubuntu to play online games, watch movies and listen to music. I guess when he go to school we may be forced to use Windows because many educational software forced by schools run only in Windows. But this is for 2 or 3 years later and no fear yet.

 

Our main reason to still have Windows on our home PC is needs of my wife. She is getting her master degree from university. Needs to prepare documents for her professors so must use same office suite even with same version and same series of fonts with them, otherwise they will not accept the work. As MS Office is widely adopted in Iran, almost all hear classmates also use MS Word and MS Excel file formats to share with them. Tragedy does not ends here. Her university portal just work with specific versions of Internet Explorer. If she want to track her student information from that portal, she must use Internet Explorer. Their university e-learning program runs on Chrome after installing some stuff from Adobe, didn't try it on Ubuntu but it may not work correctly on Ubuntu too.

Ubuntu
Ubuntu

Windows in not legally sold in Iran and almost all installations are cracked versions. So we love to switch completely to Ubuntu. It also need lower hardware requirements. Now what we can do to switch to Ubuntu and not using Windows? Can we wait under graduation of my wife and hoping my future school of my son does not force to use Windows only educational software?

 

Honestly I have no definite solution. My wife is no tech savvy and is not very comfortable switch form Windows and MS Office to Ubuntu and LibreOffice. She occasionally searches the web and produces documents based on this searches.

 

But something has happened and is changing the stations. During last few months I released our home ADSL internet volume is consumed very fast. A 5GB limit is reached during a couple of days while in past this was lasted for couple of weeks. I started thinking what causes this. We have 3 android devices in the home. All automatic updates were on. Changed status of auto update of all to off. Checked 2 Ubuntu devices, home PC and my laptop. They were in ask before mode. All of this made situation better but still one place remained to get inspected. You guessed correct, this was Windows 10 on home PC. I checked its auto-update settings. Surprisingly find out that there is no settings for that. I was unable to make it off. Searching the internet showed that Windows 10 Home edition does not allow disabling automatic update. The only work-around is making network connection as metered so Windows does not use it for getting updates. This work-around does not work for me because our home PC is connected through Ethernet not Wi-Fi and making an Ethernet port as metered is not possible.

 

As we are not going to get unlimited ADSL internet account for out home, we tried to make a hard decision. Yes we decided to move all remaining activities from Windows to Ubuntu at least for a while. I hope she can read and basic modify of MS Word file in Ubuntu/LibreOffice. Hopefully she can get friendship relationship with Ubuntu, LibreOffice, Firefox and VLC media player. This morning I created a user account in Ubuntu for her. Take time to teach her how to see her emails, how to create LibreOffice Writer documents and how to add Persian characters into it. Recently I have made home PC to a media sharing machine so our son can play movies via his Android tablet device. If no bad problem occurs all of this may lead us to have a Windows free home.

One year with Ubuntu

One year ago in a day similar to today I installed Ubuntu on my machine and started evaluating it. I did it not because MS Windows is a bad OS but because it is not available in the country due to political clashes and also because people tends to use cracked versions due to cultural problems. In the other side Ubuntu is not a very common OS but instead is totally free and legal.

I could not able to migrate my development tasks from Windows to Ubuntu because I'm a long term .Net developer. Also many of my clients/employers only want Windows. Instead I managed to switch to Ubuntu in my other daily tasks very quickly. LibreOffice replaced MS Office very easily. Internet browsing could be done in Ubuntu very easily too.

During the year I did my best to migrate all my tasks to Ubuntu. I found many alternatives for my previous Windows based applications like OrchardCMS and others. Also tried hard to bring APS.NET running in Ubuntu or learn Linux friendly software development platforms.

ubuntu

Today LibreOffice works perfectly for all my office requirements. Firefox, Chrome and Thunderbird for Ubuntu help me using Web and Email very perfectly. Gimp helps me editing images very good. I even had experiences with Inkscape for vector graphics. Integration with Windows is not bad. I can remote desktop to Windows machines just from my Ubuntu machine. Ubuntu can read FAT32/NTFS partitions good. All my previous MS Office files could be read and edited by LibreOffice too. Also my 4 years old child could use Ubuntu to access online games, play videos and music and even run games and educational applications like GCompris.

I learned many command line tools and terminal during the year. I even have an operational Ubuntu VPS live on Internet that is running WordPress, RedMine and Vtiger CRM very nicely. I do all maintenance tasks of server via terminal and it is joyful.

I have tried establishing software development environments on Ubuntu. Rails, Node.js and Java have been setup successfully. Even I was able to develop simple introductory applications with help of them and Sublime Text. It was a good experience but I still have doubts about choosing which of them to continue.