Getting “This assembly was expected to be in the local runtime” store when publishing to a Docker service

After having updated some ASP.NET Core Nuget packages, this may happen on the target Docker container instance:


This can be solved by editing the project file to include:


This makes the dotnet publish to bundle all the required files.