Why You Should Give .NET Core another look
Created On: 2019-11-24
Since around Windows 7, Microsoft have provided C# compiler and project build tool (msbuild) with the OS. At that time, you can create winforms program without installing any IDE if you know how C# and .NET tools work.
A few years later, here we have free, cross platform .NET Core 3. Recently I need to port a backup tool from linux to Windows 10 and tried .NET Core 3. Here is my experience using the platform.
- .NET Core Install is easy and lightweight. Unlike Windows SDK and Visual
Studio, .Net Core SDK is quite lightweight at 119MiB. After install, you
get a
dotnet
cli tool, which can be used to create, build, test, and release your project. - Visual Studio or VS Code is not strictly needed. dotnet cli tool can manage
everything from command line. If you don't like GUI tools or IDE, you can do
everything in command line.
On the other hand, VS or VS Code does have benefits, they can show compile warnings and errors in real time. They can show method signature and documents inline. They can show F# type hints inline. etc.
- dotnet cli tool covers the whole development cycle. Create a new project
from template, add dependencies from NuGet Gallery, build your project and
run unit tests, run your project, create dll or exe for release. The only
piece missing for my use case is creating MSI installer and maybe generating
user document.
Here are some commands to show off what
dotnet
cli tool is capable of, run in powershell,dotnet --help dotnet new --help dotnet new winforms dotnet add package Argu --version 5.5.0 dotnet remove package Argu dotnet build dotnet run dotnet test dotnet publish -c Release dotnet new nunit -lang F# dotnet add reference ../foo.fsproj
.NET Core project file is a simple XML file with .csproj (C#) or .fsproj (F#) suffix. Project dependencies, version number is stored in the XML file.
To create MSI installer, wix can be used. I hope
dotnet publish
could include something simpler to use than wix. To create user document, I used markdown document and html render. There may be better options. - F# support is nice. Since recent years, F# has got top level support in .NET and .NET Core. Although it is not as pleasant to use as Haskell (probably because I am more familiar with Haskell), I think it is a good addition to C#. I will use it whenever I got the chance.
- Document is still lacking compared to GUI application development in
Linux. .NET reference document is just a reference, you have to know what is
in the system to effectively use it. Introduction documents and user guides
are lacking. Code examples are not as great as other
language/platform. Because .NET ecosystem is large, some namespace/library
may not be available in .NET Core.
For example, .fsproj XML document is quite lacking. I have to search the Internet for things as easy as how to add a Version number, can I rename built dll or exe file name. As another example, I can't find a document that describes all thread/process/async IO APIs that I can use in .NET Core.
All in all, I think .NET Core is heading to the right direction. As a developer, I am happy development in Windows and on .NET Core platform is easier than before. You should give it a try if you haven't used .NET for some time.