You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VersionPrefix defaults to 1.0.0 regardless of whether Version actually starts with 1.0.0 or not #93
The strange thing about this this logic is that if I, for example, set <Version> to 1.2.3-beta in my project, then <VersionPrefix> will be set to 1.0.0, but not used for anything. I worry that this will lead to incorrect dependencies on <VersionPrefix> always being set and meaningful.
I see two possible solutions:
(1) Only default <VersionPrefix> if we're going to use it:
changed the title [-]VersionPrefix handling issues[/-][+]VersionPrefix defaults to 1.0.0 regardless of whether Version actually starts with 1.0.0 or not[/+]on Aug 25, 2016
If <Version> were to have '*' that is replaced by suffix, then it would be a non issue. My issue is I may want to turn 1.0.0-beta into 1.0.0-beta.999 not 1.0.0-beta-999 following semver 2.
Looking at the prior art with -* in the json, I am now thinking we should just use msbuild evaluation for this sort of buildsystem supplied info.
Instead of -*, I can put arbitrary properties in my version:
<Version>1.0.0-beta-$(BuildNumber)</Version>
I can put these properties where I want and with whatever separators I want, etc .etc. This seems better than -* to me.
Then, instead of dotnet build --version-suffix 12345, I can do dotnet build -p:BuildNumber=12345. (Assuming dotnet build supports passing arbitrary msbuild args and that's the syntax, but we should support passing properties in some way.)
Basically, I'm wondering if we even need --version-suffix or if we should just lean on msbuild flexibility for this sort of thing as part of the conversion.
My opinion is that I agree with @nguerrera. With the move to MSBuild, the user gets full flexibility to use whatever property they want to make up the $(Version), and the CLI doesn't need special knowledge anymore.
However, it is good to lead users down a "path of success", which is what --version-suffix and $(VersionSuffix) are trying to do. So I'd like to keep a drop dead simple/guided way to version a user's projects. Today there is no guided way, which leads to people doing crazy things or copying something they don't understand.
If we can come up with a better guided experience for the 80% case, let's do it.
@davkean, @livarcocc, and I sat down and thought what if versions migrated directly:
<Version>1.0.0-preview-*</Version>
Then <VersionSuffix> can be passed in to populate the * (a straight replace), or if no VersionSuffix is passed in the -* will be removed from the version. This is equivalent to the behavior in project.json today.
IMO this is more intuitive than the 3 Property Prefix/Suffix/Version approach.
When does the <VersionSuffix> replace the *? It can't happen in the Sdk.props file, since the user's <Version> property won't be set yet. So it will have to happen in the Sdk.targets file. Will it be confusing that at one point the <Version> property's value will be 1.0.0-preview-*, but then later it will be changed to 1.0.0-preview-123? So depending on when a chunk of code reads the value, it will have different values. If that is OK, then this sounds like a good plan to me.
Activity
[-]VersionPrefix handling issues[/-][+]VersionPrefix defaults to 1.0.0 regardless of whether Version actually starts with 1.0.0 or not[/+]eerhardt commentedon Aug 25, 2016
The reasoning here was so the current CLI behavior could be preserved. Today, the project.json says:
And then users building the project can say
And the output assembly would get version
1.0.0-beta-12345.If we forced $(VersionSuffix) to contain the
-prefix, users would have to start saying:nguerrera commentedon Aug 25, 2016
If
<Version>were to have '*' that is replaced by suffix, then it would be a non issue. My issue is I may want to turn 1.0.0-beta into 1.0.0-beta.999 not 1.0.0-beta-999 following semver 2.nguerrera commentedon Aug 25, 2016
Looking at the prior art with -* in the json, I am now thinking we should just use msbuild evaluation for this sort of buildsystem supplied info.
Instead of -*, I can put arbitrary properties in my version:
I can put these properties where I want and with whatever separators I want, etc .etc. This seems better than -* to me.
Then, instead of
dotnet build --version-suffix 12345, I can dodotnet build -p:BuildNumber=12345. (Assuming dotnet build supports passing arbitrary msbuild args and that's the syntax, but we should support passing properties in some way.)Basically, I'm wondering if we even need
--version-suffixor if we should just lean on msbuild flexibility for this sort of thing as part of the conversion.eerhardt commentedon Aug 25, 2016
@BlackDwarf - the PM to weigh in on needing
--version-suffix.eerhardt commentedon Aug 25, 2016
My opinion is that I agree with @nguerrera. With the move to MSBuild, the user gets full flexibility to use whatever property they want to make up the $(Version), and the CLI doesn't need special knowledge anymore.
However, it is good to lead users down a "path of success", which is what
--version-suffixand $(VersionSuffix) are trying to do. So I'd like to keep a drop dead simple/guided way to version a user's projects. Today there is no guided way, which leads to people doing crazy things or copying something they don't understand.If we can come up with a better guided experience for the 80% case, let's do it.
brthor commentedon Sep 6, 2016
@davkean, @livarcocc, and I sat down and thought what if versions migrated directly:
<Version>1.0.0-preview-*</Version>Then
<VersionSuffix>can be passed in to populate the*(a straight replace), or if noVersionSuffixis passed in the-*will be removed from the version. This is equivalent to the behavior in project.json today.IMO this is more intuitive than the 3 Property Prefix/Suffix/Version approach.
eerhardt commentedon Sep 6, 2016
When does the
<VersionSuffix>replace the*? It can't happen in the Sdk.props file, since the user's<Version>property won't be set yet. So it will have to happen in the Sdk.targets file. Will it be confusing that at one point the<Version>property's value will be1.0.0-preview-*, but then later it will be changed to1.0.0-preview-123? So depending on when a chunk of code reads the value, it will have different values. If that is OK, then this sounds like a good plan to me.brthor commentedon Sep 7, 2016
@eerhardt I think the version property would remain with the star but we would populate another generated property with the evaluated value.
eerhardt commentedon Sep 7, 2016
Isn't this just a "3 Property" approach as well?
So, if I'm not mistaken, the proposed change is to:
-*to VersionPrefix.-*replaced with VersionSuffix.What if we still do the rest, but we don't rename VersionPrefix to Version? So we generate:
<VersionPrefix>1.0.0-preview-*</VersionPrefix>And then we populate the
<Version>property with the-*replaced?7 remaining items