Search code examples
asp.net-coreteamcitydotnet-cli

Publishing ASP.NET Core WebApp


I have a WebApp built using ASP.NET 2.2 and using TeamCity to deploy it. My build steps are as follow

TeamCity build steps

When I check the publish directory I can see that the wwwroot folder is missing. For my own sanity I did a dotnet build and dotnet publish (Visual Studio is not used) on my local version and I can see that the wwwroot is being copied to the publish folder.

Why there is a difference in the behaviour and what should I do please to make sure that this works?

As a side note: I am using bundleconfig.json and gulpfile.js and all content are copied fine locally.

On my local machine I have Visual Studio 2019 v16.3.8 plus the below

Installed .NET Core versions

On TeamCity I am using .NET Core SDK v2.2.402


Solution

  • So first I still don't know why when running the dotnet publish command locally it works and on TeamCity it doesn't, but here how I fixed my issue:

    1. I installed BuildBundlerMinifier to process bundleconfig.json.

    That NuGet package contains an MSBuild task that will run the exact same compilers on the bundleconfig.json file in the root of the project.

    1. I added a step to run gulp manually.