I have a project that has a target framework of .NET 6.0, and it uses a shared library which has target frameworks of both net6.0;net8.0
.
It builds correctly from VS 2022, but not when I build it from Dockerfile.
I can see in VS that it builds both a .NET 6.0 and .NET 8.0 version for the shared library.
The docker build error is this:
/usr/share/dotnet/sdk/8.0.204/Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly “MySharedAssembly”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/src/MySharedAssembly/MySharedAssembly.csproj::TargetFramework=net6.0]
This Dockerfile worked fine until I added in the shared assembly.