.NET Core on a Raspberry Pi

The Raspberry Pi is one of my favorite toys when it comes to hosting local applications or services like relational databases for testing purposes. At the moment I am trying to test an ASP.NET core application with this setup. However, getting .NET Core to run on the Raspberry Pi is not as easy as I thought, so I’d like to briefly outline the necessary steps. On GitHub you will find the download links we need. In my example I am using version 2.1.1. By following the link to the required version, you’ll see a table with different download links. ...

January 20, 2019 · 2 min · Marcel Jurtz

Partial Classes and Methods in C#

The partial keyword in C# allows you to spread a class definition across multiple files. You’ve probably seen this before when you created a WinForms application and viewed the MyForm.Designer.cs file, which contains the properties you define in the Designer. So the Visual Designer stores the entire definition of your user interface in this separate file. The class of your form itself is always marked partial. Files of partial methods must not be in different assemblies and will be merged during compilation. The IL code therefore looks exactly the same as if the class were a single file. ...

January 13, 2019 · 2 min · Marcel Jurtz

Writing .NET Core Desktop Apps with Electron.NET

The team behind GitHub has created its own interesting open source projects in addition to the web platform. One of them is Electron, a cross-platform desktop solution used for the Atom editor. Microsoft also uses Electron for Visual Studio Code. Electron runs with NodeJS, so applications for it are usually written in JavaScript. For .NET developers there is now Electron.NET available, an Electron wrapper for ASP.NET Core applications. An Electron.NET application hosts the ASP.NET Core project. Electron.NET then provides access to Electron via API. This enables platform-specific functionalities such as push notifications or clipboard access. And the best thing about it is that you don’t notice anything about the underlying JavaScript. ...

January 6, 2019 · 5 min · Marcel Jurtz

C# Attributes

During the development with C# you have certainly already encountered attributes, whether consciously or unaware. Today I want to go a little deeper into what attributes are, what kind of them are already present in the .NET framework, and how you can define your own attributes. Microsoft defines attributes as a powerful way to associate metadata or descriptive information with code. But what exactly does that mean? Classes have, among other characteristics, fields, methods, properties, but also a state and behavior. You can “decorate” code elements with attributes to further describe them. Doing so, however, has no effect on their state. ...

December 30, 2018 · 10 min · Marcel Jurtz

Using LESS with ASP.NET Core

I have already written about the advantages of a CSS preprocessor like LESS in this post. Today I want to show you how you can easily implement support for such a preprocessor in your ASP.NET Core project. I will use Gulp to create the ability to write LESS files and convert them to CSS files so that they can be integrated into the ASP.NET Core application. Finally, I will automate the whole thing so that the LESS file is converted without manual interaction on every build. ...

December 23, 2018 · 2 min · Marcel Jurtz