Skip to content
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

dotnet --version-minimal #5225

Closed
ryanbrandenburg opened this issue Feb 26, 2016 · 15 comments
Closed

dotnet --version-minimal #5225

ryanbrandenburg opened this issue Feb 26, 2016 · 15 comments
Assignees
Milestone

Comments

@ryanbrandenburg
Copy link

For our CoreClr gating mechanism and for anywhere else we want to machine read the version it would be very helpful if there was a "--version-minimal" which only returned the version without the OS version and everything else.

So, instead of

.NET Command Line Tools (1.0.0-beta-001540)

Product Information:
 Version:     1.0.0-beta-001540
 Commit Sha:  6aeed1f52d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 Runtime Id:  win10-x64

it would output

1.0.0-beta-001540
@victorhurdugaci
Copy link

Just my 2c: --version should return strictly the CLI version and then there should be a second option --extended-version (?) that displays what --version shows today.

@davidfowl
Copy link
Member

Just parse the output.

@blackdwarf
Copy link

@ryanbrandenburg is parsing the output acceptable for now?

@blackdwarf
Copy link

@victorhurdugaci also, I would actually leave --version to show just the version string and provide a --info to give you the full shebang.

@factormystic
Copy link
Contributor

--version should accept additional params for the part of the info you want to see. Then you could have --version rid (same request here), --version x.y, etc to your heart's content.

Or one param that indicates you'd like all the output in a parseable format, like --version parseable or whatever.

@blackdwarf
Copy link

@factormystic ugh, dunno...dislike it. I can understand the need to get just the version string, but I would really not like to have a --version subsystem of parsing out stuff for various special cases.

@analogrelay
Copy link
Contributor

It sounds kinda scary to start going too deep down the path of complicating the --version switch. Plenty of tools have --version output that displays more than just the version, and there are lots of tools to allow for parsing these outputs (see below). We have a file in the root of the CLI (.version) which has this data in a more easily-parseable way, could you just read that?

Examples:

› clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

› grep --version
grep (BSD grep) 2.5.1-FreeBSD

› zsh --version
zsh 5.0.8 (x86_64-apple-darwin15.0)

@ryanbrandenburg
Copy link
Author

@anurse this all started because I was unable to locate the .version file on linux. If it is available on all OS's that would be OK too, though slightly less nice since we'd have to special case things for each OS.

@analogrelay
Copy link
Contributor

The .version file definitely should be there on Linux... of course you have to use ls -a because it starts with . and is thus hidden by default

@ryanbrandenburg
Copy link
Author

I don't see it under usr/share/dotnet/, usr/share/dotnet/bin, usr/share/dotnet/runtime or usr/share/dotnet/debian, even when using ls -a. Could someone else confirm it's there on their linux machine to see if I just have a bad install somehow?

@blackdwarf
Copy link

@ryanbrandenburg I don't see it either on Ubuntu with the latest installed.

@brthor
Copy link
Contributor

brthor commented Mar 8, 2016

Clean docker image, with cli installed via .deb package:

I cannot find it either

root@c11d96627891:/usr/share/dotnet# find . -name ".version"
root@c11d96627891:/usr/share/dotnet#
root@c11d96627891:/hey# dotnet --version
.NET Command Line Tools (1.0.0-beta-001668)

Product Information:
 Version:     1.0.0-beta-001668
 Commit Sha:  N/A

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  14.04
 OS Platform: Linux
 Runtime Id:  ubuntu.14.04-x64
root@c11d96627891:/hey#

@eerhardt eerhardt self-assigned this Mar 18, 2016
@eerhardt
Copy link
Member

A discussion between @blackdwarf and @anurse produced the recommendation that dotnet --version will output just the version of the CLI with no formatting: ex. 1.0.0-beta-001880. Any "long" version and outputting other information can be handled later as the scenarios for the information arises.

@ryanbrandenburg
Copy link
Author

Cool. Although, if I might push my luck here, the format that's stored in the .version file on windows and that a couple of our tools expect is "1.0.0.001880", without the "-beta-". It's a small thing to fix on our end, but it seems like whatever the "proper" format is it should be that way everywhere. Unless I'm missing some distinction.

eerhardt referenced this issue in eerhardt/cli Mar 24, 2016
`dotnet --version` returns just the version number. This helps tools get this information without having to parse the full info.
Introduce a new argument `--info` that returns the current "long form". With this, we also change the long form to say "RID" instead of "Runtime ID" simply because that would avoid any future localization issues and thus make the parsing easier.

Fix #1607 #1882
@eerhardt
Copy link
Member

the format that's stored in the .version file on windows and that a couple of our tools expect is "1.0.0.001880", without the "-beta-". It's a small thing to fix on our end, but it seems like whatever the "proper" format is it should be that way everywhere. Unless I'm missing some distinction.

@ryanbrandenburg - the new "proper" version format is with the -beta- going forward. New .version files have this format as well.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the Backlog milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants