.NET Developer, Microsoft MVP

All Posts (322) 322


Read and Write Windows Registry in .NET Core

Yes, you read it right! It's totally possible! Even .NET Core is designed to be cross platform, but it does not mean you can not use platform specific APIs. Take Windows Registry for example, although .NET Standard can not contain Windows API like this. But there's still a way to use Windows Regisitry in .NET Core Applications. But first, you should be absolutely clear, that using platform …

Windows .NET Core Registry

Incremental Build Number for .NET Core via Azure DevOps

People familiar with the. NET framework know that we can let the compiler self-increase the version number by specifying AssemblyVersion as 10.0.*. But. NET core and. NET Standard are not. Even with open source projects like MSBump, there are certain flaws. Typically, such requirement happens on a CI/CD server. Let's take a look at how to easily handle it with Azure DevOps. About Versioning in . …

PowerShell .NET Core Azure DevOps

Send Email After Release Deployment in Azure DevOps

By default, Azure DevOps sends an email notification to team members after the compilation succeeds or fails. But in a CI/CD environment, we are more concerned about when the deployment is complete and then conducting manual or automated testing. Let's take a look at how to get Azure DevOps to automatically send mail notifications to team members after a successful deployment. Enter Project …

Azure DevOps

Fix .NET Core Website Failure After Deployment from Azure DevOps

I met a strange problem recently. After configuring the CI/CD pipeline with Azure DevOps and automatically deploy to Azure App Services, the. NET Core Website failed to start. Let's see how we can solve this problem. Find the issue First of all, fortunately, this is a staging environment. I found that the site unexpectedly did not log anything, even log directory cannot be found, which is …

Azure .NET Core Azure DevOps

Fix Azure DevOps TF14045 Error When Deploy to Azure

I encountered an error when I try to setup CI/CD in Azure DevOps, I tried to deploy a .NET Core application to Azure App Service, but Azure DevOps won't connect to Azure. This is a known issue for Microsoft. Let's see how we can manually setup a connection between Azure DevOps and Azure to workaround this issue. First, the error message I met was: Failed to get resource ID for resource type ' …

Azure Azure DevOps Azure AD

Detect Text Language using Azure Cognitive Services in .NET Core

There are many ways to identify what is the language of a text, in this era of AI, we can also add AI capabilities to our own application. I will show you to see how to use the AI Cognitive Service provided by Microsoft Azure to detect the language of a text. The prerequisite is that you will need an Azure subscription. Create Azure Cognitive Services Account Click "Create a resource", then …

Azure .NET Core AI Cognitive Service

Recommended Visual Studio Configuration for .NET Core Development

Visual Studio has always been a good friend to .NET developers, although VS Code can do .NET Core development, VS is still having a lot advantages. Let's see how to make Visual Studio more handy for .NET Core development. Basic Configuration First, please be advised, not all versions of Visual Studio supports .NET Core development, even some early version of VS2017. Some people may mistake …

Visual Studio .NET Core

ASP.NET Core Dependency Injection in ActionFilterAttribute

In ASP.NET Core, we can easily use constructor injection to make Dependent Injections on components such as Controller and ViewComponent. But how to do it with ActionFilterAttribute? The Problem My blog system has an ActionFilter for deleting subscription files, and I want to log errors when an exception happens. I use NLog as the logging component, so I need to use LogManager. …

.NET Core Dependency Injection

Caveats in ASP.NET Core Data Protection

ASP.NET Core provides a built-in Data Protection mechanism to let us encrypt or decrypt sensitive data. There are some limitations that can cause problems while bringing convenience. I met some problems these days. My Scenario My blog system has a feature to send email notifications, so you need to configure an email account to let the program use that account to send mail to an administrator …

.NET Core AES Encryption

Auto Refresh Settings Changes in ASP.NET Core Runtime

In ASP.NET Core, if you modify the settings in appsettings.json, you will have to restart the site to take effect. Is there a way to refresh and apply it automatically after you modify the settings? Background Let's take a look at a website created by ASP.NET Core default templates. It includes two settings files: appsettings.json appsettings.Development.json The former one is used in …

ASP.NET .NET Core