Search code examples
c#.netcsproj

Is the `net6` (not `net6.0`) is a valid target framework value?


Some times I see the projects with target framework set to the net6 (not net6.0) in its 'csproj' files.

    <TargetFrameworks>net6-macos;net6-windows</TargetFrameworks>

Such a projects builds and works without problems. At the same time documentation lists only net6.0-like values as a valid for the target framework in sdk-style projects.

So, the question is: does net6 tfm works by accident or it's a valid value by design? Should the usage of net6 be considered as a bug and fixed to the net6.0?


Solution

  • As conclusion: there is no any evidences that net6 is a valid tfm by design.

    Moreover, some tooling unable to work correctly with such a tfm. For example, VS for Mac will throw "Error updating Objective-C type information" error when trying to edit xib/storyboard in the project where there is incorrect tfm somewhere in the dependencies tree (community report).

    So, it's better to treat net6 tfm as an error and fix it with net6.0 to avoid some very unpredictable and surprising effects in some use cases.