Friday, March 16, 2018

ASP.NET Core Docker error: An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found

Yesterday I had some trouble to get my docker build up and running. However after I succeeded and tried to run my container using docker-compose up, I got the following error message in the container log:

An assembly specified in the application dependencies manifest (MyApp.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 problem is caused by the fact that the ASP.NET Core SDK version on the build image(2.0.0) and the referenced version in my project(2.0.3) didn’t match. Easiest solution I could find was resetting the package reference to 2.0.0 in my csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>

    <TargetFramework>netcoreapp2.0</TargetFramework>

    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>

  </PropertyGroup>

  <ItemGroup>

    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />

  </ItemGroup>

  <ItemGroup>

    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />

</ItemGroup>

</Project>

After doing that I had to stop and delete the previously created container and build and run a new instance using docker-compose build and docker-compose up.

1 comment:

Helen C Miller said...

Thanks a lot! This will be useful for every yii2 developers, as well as for people, who are new to Yii2 Development. It is well known yii2 methods are very helpful in project management and software development. It has everything to improve software development process.