@@ -69,6 +69,12 @@ public class RunCommand
6969 public string ? LaunchProfile { get ; }
7070 public bool NoLaunchProfile { get ; }
7171
72+ /// <summary>
73+ /// The verbosity of the run-portion of this command specifically. If implicit builds are performed, they will always happen
74+ /// at a quiet verbosity by default, but it's important that we enable separate verbosity for the run command itself.
75+ /// </summary>
76+ public VerbosityOptions RunCommandVerbosity { get ; private set ; }
77+
7278 /// <summary>
7379 /// True to ignore command line arguments specified by launch profile.
7480 /// </summary>
@@ -208,7 +214,7 @@ internal bool TryGetLaunchProfileSettingsIfNeeded(out ProjectLaunchSettingsModel
208214 return true ;
209215 }
210216
211- if ( MSBuildArgs . Verbosity ? . IsQuiet ( ) != true )
217+ if ( ! RunCommandVerbosity . IsQuiet ( ) )
212218 {
213219 Reporter . Output . WriteLine ( string . Format ( CliCommandStrings . UsingLaunchSettingsFromMessage , launchSettingsPath ) ) ;
214220 }
@@ -339,11 +345,20 @@ private MSBuildArgs SetupSilentBuildArgs(MSBuildArgs msbuildArgs)
339345 {
340346 msbuildArgs = msbuildArgs . CloneWithAdditionalArgs ( "-nologo" ) ;
341347
342- if ( msbuildArgs . Verbosity is null )
348+ if ( msbuildArgs . Verbosity is VerbosityOptions userVerbosity )
349+ {
350+ // if the user had a desired verbosity, we use that for the run command
351+ RunCommandVerbosity = userVerbosity ;
352+ return msbuildArgs ;
353+ }
354+ else
343355 {
356+ // Apply defaults if the user didn't expressly set the verbosity.
357+ // Setting RunCommandVerbosity to minimal ensures that we keep the previous launchsettings
358+ // and related diagnostics messages on by default.
359+ RunCommandVerbosity = VerbosityOptions . minimal ;
344360 return msbuildArgs . CloneWithVerbosity ( VerbosityOptions . quiet ) ;
345361 }
346- return msbuildArgs ;
347362 }
348363
349364 internal ICommand GetTargetCommand ( Func < ProjectCollection , ProjectInstance > ? projectFactory )
@@ -356,7 +371,7 @@ internal ICommand GetTargetCommand(Func<ProjectCollection, ProjectInstance>? pro
356371 return CreateCommandForCscBuiltProgram ( EntryPointFileFullPath ) ;
357372 }
358373
359- FacadeLogger ? logger = LoggerUtility . DetermineBinlogger ( [ ..MSBuildArgs . OtherMSBuildArgs ] , "dotnet-run" ) ;
374+ FacadeLogger ? logger = LoggerUtility . DetermineBinlogger ( [ .. MSBuildArgs . OtherMSBuildArgs ] , "dotnet-run" ) ;
360375 var project = EvaluateProject ( ProjectFileFullPath , projectFactory , MSBuildArgs , logger ) ;
361376 ValidatePreconditions ( project ) ;
362377 InvokeRunArgumentsTarget ( project , NoBuild , logger , MSBuildArgs ) ;
0 commit comments