Fix restore.cmd not recognizable command
This commit is contained in:
		
					parent
					
						
							
								90307bc71e
							
						
					
				
			
			
				commit
				
					
						29cd999b51
					
				
			
		
					 2 changed files with 17 additions and 4 deletions
				
			
		|  | @ -57,11 +57,18 @@ namespace Microsoft.DotNet.Cli.Utils | |||
| 
 | ||||
|         private static void ResolveExecutablePath(ref string executable, ref string args) | ||||
|         { | ||||
|             var fullExecutable = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, executable + Constants.ExeSuffix)); | ||||
| 
 | ||||
|             if (File.Exists(fullExecutable)) | ||||
|             foreach (string suffix in Constants.RunnableSuffixes) | ||||
|             { | ||||
|                 executable = fullExecutable; | ||||
|                 var fullExecutable = Path.GetFullPath(Path.Combine( | ||||
|                                         AppContext.BaseDirectory, executable + suffix)); | ||||
| 
 | ||||
|                 if (File.Exists(fullExecutable)) | ||||
|                 { | ||||
|                     executable = fullExecutable; | ||||
| 
 | ||||
|                     // In priority order we've found the best runnable extension, so break. | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             // On Windows, we want to avoid using "cmd" if possible (it mangles the colors, and a bunch of other things) | ||||
|  |  | |||
|  | @ -12,6 +12,12 @@ namespace Microsoft.DotNet.Cli.Utils | |||
|     internal static class Constants | ||||
|     { | ||||
|         public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; | ||||
| 
 | ||||
|         // Priority order of runnable suffixes to look for and run | ||||
|         public static readonly string[] RunnableSuffixes = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) | ||||
|                                                          ? new string[] { ".exe", ".cmd", ".bat" } | ||||
|                                                          : new string[] { string.Empty }; | ||||
| 
 | ||||
|         public static readonly string HostExecutableName = "corehost" + ExeSuffix; | ||||
|         public static readonly string DefaultConfiguration = "Debug"; | ||||
|         public static readonly string BinDirectoryName = "bin"; | ||||
|  |  | |||
		Reference in a new issue
	
	 schellap
				schellap