Issue with .Net 6 breaking changes

kesiya abraham 1 Reputation point
2022-05-10T16:32:19.567+00:00

Hi Team,

We are working on a .Net Core 3.1 project and using .Net CLI commands to run it. The machine on which we are running has a dependency on .Net 6 as well. Even though we are explicitly specifying the target framework as 3.1 in the csproj , it is showing some errors related to the new changes in .Net 6 as below

Found multiple publish output files with the same relative path:

We are able to fix the issue.

Just wondering why the dlls using .Net 6 even though we specifically asked to use .Net 3

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
323 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 48,581 Reputation points
    2022-05-10T17:49:34.847+00:00

    I assume you mean dotnet when you say the .NET CLI commands. There is only one copy of dotnet on a machine (per bitness). The latest version wins. So irrelevant of whether your code is compiling for .NET Core, .NET Standard or .NET 6 it is going to use the same tool. That makes sense because the tool itself isn't doing anything that requires it to match your app's target framework. It's just the gateway to run tools. In your case you're ultimately compiling against 3.1 so it'll use the 3.1 tools. This is not really much different than you running cmd.exe to build code for various platforms. The CLI is just the host process used to orchestrate the actual commands to run.

    0 comments No comments