0

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).

Hopeless
  • 4,397
  • 5
  • 37
  • 64
  • 1
    How are you building these projects? What does your Dockerfile look like? – Matt Thalman Apr 13 '23 at 13:18
  • 1
    BTW, .NET Core 3.1 has been unsupported since December 13, 2022. – Matt Thalman Apr 13 '23 at 13:19
  • I agree with @MattThalman, your Dockerfile is probably not doing what you think it's doing, so please post it so that we can try to help you. But first, and to make sure that's the issue, you can do the following test locally (without Docker): replace `net462` target framework with an older one that you don't have installed, and double check that `dotnet publish` inside of project A still works as expected. – eduherminio Apr 13 '23 at 16:33

0 Answers0