'Run ASP.NET Core in docker container - existing assembly 'Microsoft.Data.SqlClient' not found

I need to deploy a ASP.NET Core WebApi on a server using Docker Container. I already published the app and built the Docker image with docker build -t my_project. Everything fine up to this point.

However, when trying to run the container with docker run my_project --name aup_project I get an error stating an assembly specified in the application dependencies manifest (AuP_Project.deps.json) was not found:

Error:
An assembly specified in the application dependencies manifest (AuP_Project.deps.json) was not found:
    package: 'Microsoft.Data.SqlClient', version: '2.0.1'
    path: 'runtimes/unix/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll'

I checked the published folder and that .dll file in the specified path runtimes/unix/lib/netcoreapp3.1/Microsoft.Data.SqlClient.dll is in that folder. So I don't understand, why it can't be found.

I'm new to ASP.NET Core Deployment as well as to Docker, so maybe I just misunderstand the error somehow? Or can I just delete that section in the .deps.json-file?

Any help is appreciated ;)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source