Runar Ovesen Hjerpbakk

Science-based software development

An assembly specified in the application dependencies manifest was not found

This happened a while ago, but might be relevant again in the future.

I created a website using ASP.Net Core and ran it through a Docker Container.

$ docker run kitchen-responsible

Worked perfectly for a long time, but after updating a nuget package it started to fail with:

Error:
  An assembly specified in the application dependencies manifest (KitchenResponsibleService.deps.json) was not found:
	package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1'
	path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'
  This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
	aspnetcore-store-2.0.3.xml

The nuget packages now targeted different versions of the runtime and the container did not contain them all. The solution was to add <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> to the .csproj file so the dotnet publish command bundles all the required files.

For example:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <PublishWithAspNetCoreTargetManifest>false<PublishWithAspNetCoreTargetManifest>
  </PropertyGroup>
...