Rico Suter's blog.
 

Articles

Use private Azure DevOps NuGet package feeds with the .NET Core CLI

If you have a .NET Core project which references a NuGet package from a private Azure DevOps package feed, you cannot just build the project in CLI because you are not authorized to access the feed: When running dotnet restore, you’ll end up with this error message:
Read More ›

How to publish an NPM package in AppVeyor

For some open-source projects I need to publish NPM packages during the CI release on AppVeyor. Unlike with NuGet packages, you have to do that manually by installing NodeJS and NPM, creating an .npmrc file with your NPM credentials and publishing the package. This blog post describes this procedure in detail.
Read More ›

Automatically migrate your Entity Framework Core managed database on ASP.NET Core application start

If you use Entity Framework Core with migrations in your ASP.NET Core application and want to ensure that the database structure always matches the currently running application, you can simply migrate the database on application startup. This way you just have to redeploy your application and everything like migrating the data, change the schemas, etc. is done when the application is restarted.
Read More ›

Advanced Newtonsoft.Json: Dynamically rename or ignore properties without changing the serialized class

This article describes how to implement a custom contract resolver, so that you can ignore or rename serialized JSON properties where the serialization happens and without changing the serialized classes.
Read More ›

NSwag Tutorial: Implement a custom operation processor to define ReDoc code samples

With NSwag you can implement custom operation processors and apply them to ASP.NET Core MVC or Web API controller operations. These processors then get picked up by NSwag and are applied to the given operation in the Swagger specification.
Read More ›

How to instantiate a generic type in TypeScript

This article shows how to instantiate a generic type in TypeScript.
Read More ›

Use T4 TextTemplatingFilePreprocessor in .NET Standard or PCL libraries

For my projects NJsonSchema and NSwag I wanted to use T4 templates to programmatically generate code generating code (TextTemplatingFilePreprocessor). Adding the .tt file with its generated C# class works, even if the files are added to a PCL (Portable Class Library) or .NET Standard 1.0 project. The problem is, that the produced code does not compile because the used PCL Profile 259 (same as .NET Standard 1.0) is missing some required classes and reflection methods. To fix the compiler errors, you have to provide the missing types and methods in your assembly. To avoid name collisions with potential client assemblies you need to declare all these extensions as internal and as a consequence the generated class too (this may be a deal-breaker).
Read More ›

Aurelia JS: Detect dirty checked properties during development

I am currently working on new single-page web application based on the Aurelia framework. To avoid performance problems, we want to completely avoid dirty checked properties and method calls. Bindings are dirty checked whenever the framework cannot use another mechanismn than regularly polling for changes. It is important to detect dirty checked properties as early as possible so that they can direcly be avoided and not too many depenencies have to be changed.
Read More ›

Implement custom MSBuild tasks and distribute them via NuGet

In this article describes how to implement MSBuild tasks with inline C# or in an external .NET assembly. After doing so, we will bundle these tasks in a NuGet package, so that they can easily be distributed and updated via NuGet and executed as part of the MSBuild compilation process. This is a powerfull technique to share and manage MSBuild tasks (e.g. build scripts, code generators, etc.) in bigger environments (enterprises, open-source libraries, common/shared tasks).
Read More ›

Aurelia JS: Implement a dialog service which renders Bootstrap UI dialogs

I’m currently working on an SPA (single-page application) which uses the Aurelia JavaScript client framework and Bootstrap UI CSS framework. In the application I need to show various custom dialogs. This is why I implemented a reusable dialog service class which simplifies the creation of Bootstrap based dialogs. In this article I’d like to share and explain the code of this dialog service and the required helper classes. The sample code is written in TypeScript but it can easily be converted to ES6 JavaScript.
Read More ›