Publishing Dotnet Core creates multiples nested directories

This is one of the errors that we encountered in the ASP.NET core build process. To this date, this issue can be easily reproduced by creating a ASP.NET core web api process and repeating ‘dotnet publish’ command with using an output directory and parameter –output. However, it does not happen with the simple console applications.

When we try to publish files, it creates nested multiple output directories like below: Read More »

Deploy ASP.NET Core App as Azure Containers Instances (ACI)

Microsoft has invested billions in Azure to drive technology and also hired best of the minds on this planet. From last few months, Azure has been launching new container-focused products and services on a regular basis. One of these products is Azure Container Instances. It acts as a bridge between platform as a service and infrastructure as a service architecture. Perhaps it would be okay to call this service as “Container as a Service”. Azure Container Instances (ACI) allows to rapidly create and launch containerized applications, without any overhead and with an easily scriptable set of commands. Designed to work Read More »

ASP.NET Core App fails to start with error: ‘A path base can only be configured using IApplicationBuilder.UsePathBase().’

In one of the cases with setting up builds for new source code repositories we came across this issue. One of the microservices was written in ASP.NET core using Visual Studio. It was working fine using Visual Studio or when hosted using IIS, but it fails to start with below error when using dotnet native command inside docker image. The error message was like below:

System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase().
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__7.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Read More »

Build ASP.NET Core Web App and deploy as Azure Web App on Containers

Azure Web Apps or Azure App Service Web Apps or simply Azure Websites is a PaaS service from Microsoft Azure which can be used to host web apps or APIs build using a variety of programming languages like ASP.NET, ASP.NET Core, Java, Ruby, PHP etc. It is also optimized for hosting web applications and containers, in case the SDK version required is not already supported by Web Apps. Rather than using ACS (Azure Container Services) and AKS (Azure Kubernetes Service), Azure Web Apps are more suitable for deploying long running containers. Also they become more affordable in terms of pricing as compared to the ACS and AKS. In this post, we’ll discuss how to create a very basic ASP.NET Core App and then deploy it as a container on Azure Web App. Read More »

Dotnet Core 2.0 build fails with Error MSB4062: The “GetDotNetHost” task could not be loaded from the assembly

We were recently observing this issue with one of the new source code repositories for a solution that was written in .NET Core 2.0. The source code was coded using Visual Studio and it was working fine on the developers machine. However, when building it using dotnet core publish task, it kept failing with below error:

T12:47:54.2728059Z C:\Windows\ServiceProfiles\NetworkService.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.4\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(45,5): error MSB4062: The “GetDotNetHost” task could not be loaded from the assembly C:\Windows\ServiceProfiles\NetworkService.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.4\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll. Assembly with same name is already loaded Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
Read More »