dotnet build --version-suffix not working?
See original GitHub issueSteps to reproduce
project.json has the following version number :
{ "version": "1.1.0-beta-*" }
The following C# snippet I use for retrieve the version number :
public class Program { public static void Main(string[] args) { var versionInfo = (typeof(Program) .GetTypeInfo() .Assembly .GetCustomAttribute(typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute)?.InformationalVersion; Console.WriteLine(versionInfo); } }
After this I build with the following cli command :
dotnet build --version-suffix 1234
But the output of the programm would only “1.1.0-beta” without the suffix ? What did I miss?
Expected behavior
Output ‘1.1.0-beta-1234’
Actual behavior
Output ‘1.1.0-beta’
Environment data
`.NET Command Line Tools (1.0.0-preview2-003121)
Product Information: Version: 1.0.0-preview2-003121 Commit SHA-1 hash: 1e9d529bc5
Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64`
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (9 by maintainers)
Top GitHub Comments
@NickCraver Try this in your csproj-file:
This way people can set the Version-property through the Visual Studio UI and if you supply a VersionSuffix it still gets appended.
@dasMulli After posting this, I dug in and realized the same:
<Version>4.0.0</Version>
with--version-suffix
doesn’t work. That’s not intuitive, IMO. It’s a suffix, meaning it gets appended to the end…that’s the meaning of the word. Intuitively, I would expect the<Version>
+<VersionSuffix>
to work, or error when both are supplied since won’t work, due to it being unintuitive.I think
<VersionPrefix>
is not the correct name, it’s really<VersionNumber>
given the behavior.I have moved to
<VersionPrefix>
in my projects, but it’s not a great. For example, if a user edits the Version through the UI (just once), that changes the.csproj
from<VersionPrefix>
to<Version>
(both are there, but<Version>
trumps), and all the build arguments just stop working. I just don’t agree with the current behavior, it defaults to failure and releasing not-ready code in several unintuitive and accidental cases.As a practical impact: I will now have to make sure in every PR that no one used the UI to edit the version number in order to bump it (as one would intuitively do), since that will break all of my versioning until fixed.