Open lucapivato opened 2 years ago
Docker tooling doesn't support adding docker support on projects with TargetFramwroks. Looks like you added the TargetFrameworks after adding docker support. Having said that it could still work as long as you have the TargetFrameworkIdentifier
(which is derived from the TargetFramwroks), DockerDefaultTargetOS
and the base image defined in the dockerfile all compatible. For example, you can't use net48 (.NETFramework) on Linux OS.
Thank you for your answer.
Tried:
\
\
Doesn't seem to make a difference:
Removing net48 from the target frameworks removes the OS switch message box (basically DockerDefaultTargetOS seems not to be used).
But keeping net5.0;net6.0 still fails for net6.0.
So I guess the final answer is that docker tooling doesn't support multiple targets?
One of the .Net targets sets the TargetFrameworkIdentifier
based on the TargetFramework
and TargetFrameworks
, so this value shouldn't be set in the project. The Container.targets
from microsoft.visualstudio.azure.containers.tools.targets nuget package overrides the DockerDefaultTargetOS
to Windows if the TargetFrameworkIdentifier
is .NETFramework
irrespective of what is defined in the project file. So having a TargetFrameworks with mix of .NETCore and .NETFrameworks will results into different docker os and one of the docker build is going to fail. Initially I thought having a right set of matching DockerTargetOS, base image and targetframework would work, but it didn't.
Having a compose project targeting multiple frameworks is not a supported scenario.
I am facing the same issue as per original ticket description.
Is there any plan to support multiple TargetFrameworks
in a Docker run?
Checked everywhere I could search but didn't find any meaningful information. Any help is highly appreciated. I feel it should be fairly simple unless there is a bug in the docker tools.
I have projects with multiple targets, like this:
\net5.0;net6.0\
or
\net48;net6.0\
or
\net48;net5.0;net6.0\
Problems:
Docker tools for Visual Studio seem to get confused:
I cannot find any way to set 1) the target OS and/or 2) the target framework. Something as simple as setting the OS to Linux and the TargetFramework to "net6.0" when \ is set either "net48;net5.0;net6.0" or "net5.0;net6.0".
Tried:
Thanks.