I've tried searching around for hours and could not find a solution to this problem.
Suppose I have 1 project (A) targeting netcoreapp3.1 That project references multitargeting project (B) which targets net462 and netcoreapp3.1
When building the project A in my dev machine, everything is fine because my machine has all the required SDKs installed.
However when building with docker which uses mcr.microsoft.com/dotnet/sdk:3.1, the build failed as there is no .NET Framework 4.6.2 in the image.
I'm surprised that why it need net462? The main project A targets netcoreapp3.1 so I expect the project B will be built using netcoreapp3.1 and not requiring net462 at all.
The build using dotnet publish
defined in the Dockerfile.
Do I have any option to make it build successfully in this scenario or I have to install the net462 framework in the docker image (which I'm not sure how).