Sdk: `dotnet --version` doesn't work on runtime (not SDK install)

Created on 15 Aug 2017  路  8Comments  路  Source: dotnet/sdk

Steps to reproduce

download and install dotnet-runtime-2.0.0-win-x64.exe from https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x64.exe

open powershell window

call dotnet --version

Expected behavior

expect that version 2.0.0 would be displayed

Actual behavior

Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

Actual output

PS C:\Users\lee.campbell> dotnet

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help            Display help.
  --version         Display version.

path-to-application:
  The path to an application .dll file to execute.
PS C:\Users\lee.campbell> dotnet --version
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
PS C:\Users\lee.campbell> dotnet --info

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

PS C:\Users\lee.campbell>

Note that while I _can_ get the version by running dotnet --info the default no-argument output tells me to run dotnet --version which is then unsupported.
It seems that if this is unsupported, then it should suggest I run the --info, or alternatively support should be implemented

Most helpful comment

Thanks for the feedback, but I think your comment is missing my point.
I am not entering into a discussion on SDK vs runtime vs CLI.
This issue is simply pointing out the internal inconsistency of the tool.
i.e.
Typing dotnet tells you that you should use dotnet --version, however that command is not supported.

All 8 comments

Some previous discussion occurred in https://github.com/dotnet/cli/issues/3773 where the maintainers said this won't be changed.

Thanks for the feedback, but I think your comment is missing my point.
I am not entering into a discussion on SDK vs runtime vs CLI.
This issue is simply pointing out the internal inconsistency of the tool.
i.e.
Typing dotnet tells you that you should use dotnet --version, however that command is not supported.

To expand the problem a bit more, under runtime version 1.1.2 ,
dotnet --info

gives an error.

dotnet --version

does give version information like 2.0.0 does with dotnet --info. So in summary if I wish to test that a client has a suitable dotnet core version installed, my best test is to look at the file date of the executable C:\Program Filesdotnetdotnet.exe

Did you just need to close and reopen powershell window? I've had that happen after an install.

In my case, I was just running on Windows in a CMD.EXE command window. The behavior was consistent even with reopening windows and exactly as the OP outlined in the first section of this issue.

Linking https://github.com/dotnet/core-setup/issues/675 as that added --list-runtimes and --list-sdks implemented in the host (not the CLI) which will be in the 2.1 release.

Hi.. I am getting the same error in Amazon Linux.. I tried multiple ways to re-install by using earlier comments but still same issue. Please find the error below:
error

This is highly confusing. dotnet CLI should really support --version, but if it doesn't then then output of dotnet (without arguments) should not list:

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
-h|--help Display help.
--version Display version.

path-to-application:
The path to an application .dll file to execute.

On the other hand, dotnet --info works, but is not listed in the output above.

Was this page helpful?
0 / 5 - 0 ratings