Edi Wang

.NET and Azure Developer

All Posts

How to Pack a .NET Core Class Library and Upload to NuGet

NuGet is the package manager of the. NET world, we can both use official website nuget.org, or build our own corporate and private servers. Now, with . NET Core, it's easier than ever to pack and upload a NuGet package, let's take a look! NuGet Account If you want your package to be used by every .NET developers in the world, then you need to have a nuget.org account to upload your own package.  …
.NET NuGet

Send Email in .NET Core via MailKit

The ability to send e-mail notifications is common in a variety of systems. My blog can also send emails to administrators when there are new comments, new replies, or when articles are referenced by other sites. So in. NET Core, how can we send an e-mail? My case will use Microsoft Outlook.com's personal account to send e-mail, using the SMTP protocol. But you can also do it with other SMTP- …
.NET Email MailKit SMTP

Use Environment Specific nlog.config in ASP.NET Core

ASP.NET Core has built-in aspsettings.env.json which can automatically apply to different environments. But how about NLog? In official examples, it only got one nlog.config file which will be used in all environments. Let's see how we can change it to use different config files on different environments. Why do we need this This requirement actually came from this blog system. My blog runs on …
.NET NLog

Operate Git with .NET Core

Git is the preferred source code version control tool for many programmers, and I've recently switched from TFVC to Git. I am going to show you how to operate Git with .NET Core. Why am I doing this First of all, we do have a lot of good Git clients, such as GitHub for Windows, VS/VS Code, git GUI, and so on, all quite mature, there is no need for us to reinvent this wheel in own. NET/C#. But on …
.NET Git

Restart an ASP.NET Core Application Programmatically

We developers won't have access to servers all the time, and without management capabilities, it will be difficut to restart a web application. However, in ASP.NET Core, there is a way for us to programmatically restart our application without requring management capabilities from server admins. IApplicationLifetime There is a IApplicationLifetime interface in ASP.NET Core which can handle events …
.NET ASP.NET

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 …
.NET Windows Registry

Incremental Build Number for .NET Core via Azure DevOps

People familiar with the. NET framework knows 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 a requirement happens on a CI/CD server. Let's take a look at how to easily handle it with Azure DevOps. About Versioning in …
.NET PowerShell 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 very …
.NET Azure Azure DevOps

Fix Azure DevOps TF14045 Error When Deploy to Azure

I encountered an error when I tried 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 set up a connection between Azure DevOps and Azure to work around this issue. First, the error message I met was: Failed to get resource ID for resource type ' …
Azure Azure DevOps Azure AD