diff --git a/src/Microsoft.DotNet.Tools.Run/RunCommand.cs b/src/Microsoft.DotNet.Tools.Run/RunCommand.cs index ebe9c34f4..7dddd6281 100644 --- a/src/Microsoft.DotNet.Tools.Run/RunCommand.cs +++ b/src/Microsoft.DotNet.Tools.Run/RunCommand.cs @@ -20,38 +20,38 @@ namespace Microsoft.DotNet.Tools.Run public string Project = null; public IReadOnlyList Args = null; - bool _isInteractive = false; ProjectContext _context; List _args; public int Start() { - CalculateDefaultsForNonAssigned(); - - if (_isInteractive) + if (IsInteractive()) { return RunInteractive(Project); } else { + CalculateDefaultsForNonAssigned(); return RunExecutable(); } } - private void CalculateDefaultsForNonAssigned() + private bool IsInteractive() { if (!string.IsNullOrEmpty(Project)) { - if (File.Exists(Project) && (Path.GetExtension(Project) == ".csx")) + if (File.Exists(Project) && (Path.GetExtension(Project).ToLowerInvariant() == ".csx")) { - _isInteractive = true; - return; + return true; } } - else - { - Project = Directory.GetCurrentDirectory(); - } + + return false; + } + + private void CalculateDefaultsForNonAssigned() + { + Project = Directory.GetCurrentDirectory(); if (string.IsNullOrWhiteSpace(Configuration)) {