I have a C# Visual Studio console application with Docker Support added.The application references libraries as assemblies (dll files). When running the application as a console app, the dll files are copied to the appropriate bin folder. When publishing with Docker, the build fails with warnings:
...warning MSB3245: Could not resolve this reference. Could not locate the assembly...
The build cannot find the referenced assembles. I am using the default unmodified docker file.
I understand that the .dockerignore file is excluding the bin folder. However, the dlls are explicity referenced in the csproj file. I do not want to modify .dockerignore, removing the bin exclusion, since that will cause many, many other files to be copied into the image unnecessarily.
I can not include the dll references as projects in my solution. I do not have the source for all dlls and we have a large code base maintained by many teams.
We do not use private nuget packages. Again, we have a large code base, multiple teams, etc.
I have also set Copy Local to true for the dll files.
I must be missing something simple. Directly referencing dll files is an incredibly common use case (if not the most common), yet I can't seem to find a simple solution that does not invovle custom build scripts, manually copying files around, etc. What is the common practice/solution for this problem?
FYI I'm assuming this is a .NET Core project with a Dockerfile using build in a container.
If the .dlls are in a folder excluded by the .dockerignore file they will not be available to the build running in the Dockerfile which will then fail (or at least not copy them). I recommend moving your external references to a folder named "References" (or similar) outside the bin folder and reference them from there.