-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VersionPrefix and VersionSuffix are misnamed #1952
Comments
The naming used here should follow the semver, right? According to that spec, both GitVersion uses the term |
I think @JakeGinnivan might know better than me where |
fyi the logic comes from https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.DefaultAssemblyInfo.targets#L18-L22 It's hard since you need to be able to construct the |
Based on the comments above, it seems that the general opinion is that "1.0.0-beta1" is the "version", implying that |
Unfortunately SemVer doesn't define terms to describe the "1.0.0" and "beta1" parts of the version "1.0.0-beta1" so I guess we'll have to define them (or look for precedents elsewhere). But, before going too far down that path, perhaps we should challenge
Why? |
My reasoning is mostly based on the ability and need to pass version-related properties as arguments to msbuild invocations, e.g. from CI. You can currently pass However, take the following project file for example: <Project>
<PropertyGroup>
<Version Condition="'$(Version)' == ''">1.0.0</Version>
<Version Condition="'$(PreReleaseLabel)' != ''">$(Version)-$(PreReleaseLabel)</Version>
</PropertyGroup>
<Target Name="Build">
<Message Importance="high" Text="Version: $(Version)"/>
</Target>
</Project>
My problem with this is that 2. and 3. look similar - both properties set to a value - but behave differently because of the way global msbuild properties work, which is confusing for beginners trying to set up their project / CI. There are a few workarounds for that but they would require a different property ( Summed up, I think it's best to leave |
Therein lies the problem. If I pass Foo, and FooSuffix, I expected the value of Foo to be suffixed by the value of FooSuffix. The current behaviour is surprising and does not follow the semantics conveyed by the property names.
It is only expected after you have experienced the surprising behaviour or read the documentation, and you have retained and recalled that knowledge before the occasion. The names (semantics) cannot be relied on to remind the user of the expected behaviour. I still haven't seen a defense of the assertion that we need the version to be composed of two properties. What does this offer over a single property named |
Yes, SemVer defines them as such:
And:
So SemVer calls these pre-release strings that are suffixed to the |
@asbjornu defining However, I still challenge the need for multiple properties. I haven't seen a strong argument for having multiple properties over a single |
This issue was moved to dotnet/sdk#1131 |
Prefix:
The value of this property never prefixes the version. That would imply that the version is another string of characters, and the value of this property precedes it. This never happens.
Until I read the documentation, I was surprised to see values of
VersionPrefix
of the form "1.0.0", since "1.0.0" is not a prefix to the version. It is the version.The same argument could be applied to
VersionSuffix
, depending on the interpretation of "version". If "1.0.0" is the "version" in "1.0.0-beta1" then it's true to say that the "version suffix" is "beta1", but if "1.0.0-beta1" is the "version", thenVersionSuffix
is similarly misnamed.Update:
Based on the comments below, it seems that the general opinion is that "1.0.0-beta1" is the "version", implying that
VersionSuffix
is also misnamed. I'm re-titling the issue from "VersionPrefix is misnamed" to "VersionPrefix and VersionSuffix are misnamed".The text was updated successfully, but these errors were encountered: