Skip to main content

ASP.NET Core 5 – Enabling Razor runtime compilation

Razor files (.cshtml) are compiled at both build and publish time and this gives better performance as your views are compiled. We can also enable runtime compilation, which will help developers to see any modified view change in real-time, without starting the application again. The recent version of ASP.NET Core (ASP.NET Core 5.0) Preview 2 came out and you can start building an app on ASP.NET Core 5.0 framework. ASP.NET Core 5.0 changes this experience for enabling razor runtime compilation. This is now available as an option while creating the ASP.NET Core 5.0 project. It’s a tiny enhancement, but good to know. Read More

Interfaces in C# 8.0 gets a makeover

Even today when I am in deep sleep and someone wakes me up and asks “Can C# Interfaces have any access modifiers?” My answer would be “Hell, NO“. As this is what stored very deep in my mind and being a programmer have learned this over the years. But the time has come to erase those memories as with C# 8.0, interfaces are getting a whole makeover. Therefore, our interfaces knowledge also needs to be revisited. C# 8.0 introduces a new feature called “Default implementations in interfaces” and this will change a lot of things. In this post, we’ll see this new feature and what you need to know now about interfaces. Read More

A clean way to add Swagger to ASP.NET Core application

Swagger needs no introduction. It is one of the best methods to test your WEB APIs. Adding swagger to your ASP.NET Core application is very easy and straightforward. I already have a couple of posts on my blog on Swagger. Swagger comes with many options and customization to help you prepare better API documentation. The ASP.NET Core Startup.cs is the place to add Swagger or any middleware that you would like to use in your ASP.NET Core application. The Startup.cs file will become lengthy when we use more swagger customization. So in this post, we’ll see a clean way to add Swagger to ASP.NET Core application using C# extension methods. Read More

Create a Trimmed Self-Contained Single Executable in .NET Core 3.0

A self-contained app is a great way to share your application as all components, runtime, and framework are included with the application. All you have to provide is the application .exe file without worrying about the presence of framework or runtime installation status on other machines. .NET Core 3.0 Preview 6 is out and there are a lot more new features. One of the useful feature is the introduction of PublishTrimmed flag. This flag reduces the size of the executable to a great extent and create a trimmed self-contained single executable in .NET Core 3.0.
Read More