{
assert(argc > 1);
if (pal::strcasecmp(_X("-h"), argv[1]) == 0 ||
- pal::strcasecmp(_X("--help"), argv[1]) == 0)
+ pal::strcasecmp(_X("--help"), argv[1]) == 0 ||
+ pal::strcasecmp(_X("-?"), argv[1]) == 0 ||
+ pal::strcasecmp(_X("/?"), argv[1]) == 0)
{
muxer_usage(false);
return StatusCode::InvalidArgFailure;
return StatusCode::Success;
}
- trace::error(_X("Did you mean to run dotnet SDK commands? Please install dotnet SDK from:"));
- trace::error(_X(" %s"), DOTNET_CORE_GETTING_STARTED_URL);
return StatusCode::LibHostSdkFindFailure;
}
#include "fx_ver.h"
#include "trace.h"
#include "utils.h"
+#include "sdk_info.h"
typedef web::json::value json_value;
typedef web::json::object json_object;
return true;
}
- if (global_cli_version.empty())
+ if (!global_cli_version.empty())
{
- trace::verbose(_X("It was not possible to find any SDK version"));
+ trace::error(_X("A compatible installed dotnet SDK for global.json version: [%s] from [%s] was not found"), global_cli_version.c_str(), global.c_str());
+ trace::error(_X("Please install the [%s] SDK or update [%s] with an installed dotnet SDK:"), global_cli_version.c_str(), global.c_str());
}
- else
+ if (global_cli_version.empty() || !sdk_info::print_all_sdks(dotnet_root, _X(" ")))
{
- trace::error(_X("A compatible SDK version for global.json version: [%s] from [%s] was not found"), global_cli_version.c_str(), global.c_str());
+ trace::error(_X(" It was not possible to find any installed dotnet SDKs"));
+ trace::error(_X(" Did you mean to run dotnet SDK commands? Please install dotnet SDK from:"));
+ trace::error(_X(" %s"), DOTNET_CORE_GETTING_STARTED_URL);
}
return false;
}
// Set specified CLI version = 9999.3.4-global-dummy
SetGlobalJsonVersion("SingleDigit-global.json");
+ // Specified CLI version: 9999.3.4-global-dummy
+ // CWD: empty
+ // User: empty
+ // Exe: empty
+ // Expected: no compatible version and a specific error messages
+ dotnet.Exec("help")
+ .WorkingDirectory(_currentWorkingDir)
+ .WithUserProfile(_userDir)
+ .Environment(s_DefaultEnvironment)
+ .EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0")
+ .CaptureStdOut()
+ .CaptureStdErr()
+ .Execute(fExpectedToFail: true)
+ .Should()
+ .Fail()
+ .And
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .HaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
+
// Add some dummy versions
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.4.1", "9999.3.4-dummy");
.Should()
.Fail()
.And
- .HaveStdErrContaining("A compatible SDK version for global.json version");
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .NotHaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
// Add specified CLI version
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.3");
.Should()
.Fail()
.And
- .HaveStdErrContaining("A compatible SDK version for global.json version");
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .NotHaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
// Add specified CLI version
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.4");
// Set specified CLI version = 9999.3.304-global-dummy
SetGlobalJsonVersion("TwoPart-global.json");
+ // Specified CLI version: 9999.3.304-global-dummy
+ // CWD: empty
+ // User: empty
+ // Exe: empty
+ // Expected: no compatible version and a specific error messages
+ dotnet.Exec("help")
+ .WorkingDirectory(_currentWorkingDir)
+ .WithUserProfile(_userDir)
+ .Environment(s_DefaultEnvironment)
+ .EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0")
+ .CaptureStdOut()
+ .CaptureStdErr()
+ .Execute(fExpectedToFail: true)
+ .Should()
+ .Fail()
+ .And
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .HaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
+
// Add some dummy versions
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.57", "9999.3.4-dummy");
.Should()
.Fail()
.And
- .HaveStdErrContaining("A compatible SDK version for global.json version");
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .NotHaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
// Add specified CLI version
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.300", "9999.7.304-global-dummy");
.Should()
.Fail()
.And
- .HaveStdErrContaining("A compatible SDK version for global.json version");
+ .HaveStdErrContaining("A compatible installed dotnet SDK for global.json version")
+ .And
+ .NotHaveStdErrContaining("It was not possible to find any installed dotnet SDKs");
// Add specified CLI version
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.304");
// CWD: empty
// User: empty
// Exe: -1.-1.-1
- // Expected: no compatible version and a specific error message
+ // Expected: no compatible version and a specific error messages
dotnet.Exec("help")
.WorkingDirectory(_currentWorkingDir)
.WithUserProfile(_userDir)
.Should()
.Fail()
.And
- .HaveStdErrContaining("It was not possible to find any SDK version");
+ .HaveStdErrContaining("It was not possible to find any installed dotnet SDKs")
+ .And
+ .HaveStdErrContaining("Did you mean to run dotnet SDK commands? Please install dotnet SDK from");
// Add specified CLI version
AddAvailableSdkVersions(_exeSdkBaseDir, "9999.0.4");