Proj0245: Don’t mix Version and VersionPrefix/VersionSuffix
By default the VersionPrefix and VersionSuffix nodes have no semantic meaning by themselves.
They are used as a default value for the Version node.
Therefore setting the values of VersionPrefix or VersionSuffix loses its purpose once
Version is also set.
By default VersionPrefix has value 1.0.0 and VersionSuffix is empty.
Version defaults to {VersionPrefix}-{VersionSuffix} if VersionSuffix is non-empty
or {VersionPrefix} otherwise.
Non-compliant
Resulting in version 1.2.3:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Version>1.2.3</Version>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>preview001</VersionSuffix>
</PropertyGroup>
</Project>
Or resulting in version 1.2.3:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Version>1.2.3</Version>
<VersionPrefix>2.0.0</VersionPrefix>
</PropertyGroup>
</Project>
Or resulting in version 1.2.3:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Version>1.2.3</Version>
<VersionSuffix>preview001</VersionSuffix>
</PropertyGroup>
</Project>
Compliant
Resulting in version 1.2.3:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Version>1.2.3</Version>
</PropertyGroup>
</Project>
Or resulting in version 2.0.0-preview001:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Version>2.0.0-preview001</Version>
</PropertyGroup>
</Project>
Or resulting in version 2.0.0-preview001:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>preview001</VersionSuffix>
</PropertyGroup>
</Project>
Or resulting in version 2.0.0:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<VersionPrefix>2.0.0</VersionPrefix>
</PropertyGroup>
</Project>
Or resulting in version 1.0.0-preview001:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<VersionSuffix>preview001</VersionPrefix>
</PropertyGroup>
</Project>