docker.net-coretagscontainers

Why do I get a the wrong .Net core version reported when specifying the correct container tag?


In my build pipeline I pull this container:

mcr.microsoft.com/dotnet/sdk:8.0.405

When I run dotnet format --version within that container I get the following version number:

8.3.546805+86f5186deeea364bd8541d51657e52a54b2a96b2

Why would I get .NET format version 8.3 when I am specifically asking for container version 8.0.405 ?

Locally I have the .Net SDK installed at version 8.0.405 and when I run dotnet format --version I correctly get:

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.405

I just do not understand what the discrepancy is.

This is causing me an issue as the format command behaves differently on my build server to running it locally but the versions should be exactly the same.


Solution

  • dotnet --version prints the SDK version which is 8.0.405.

    dotnet format --version prints out the version number of the dotnet-format command which doesn't necessarily match the SDK version. In your case, the container version is newer than the one you've installed locally.

    Each part of the SDK has it's own version number which is very clear if you do dotnet build --version which will print out 17.11.9.46202 in the 8.0.405 container.