@@ -74,29 +74,32 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
7474 return ExitCodeConstants . FailedToTrustCertificates ;
7575 }
7676
77- appHostCompatabilityCheck = await AppHostHelper . CheckAppHostCompatabilityAsync ( _runner , effectiveAppHostProjectFile , cancellationToken ) ;
77+ var watch = parseResult . GetValue < bool > ( "--watch" ) ;
7878
79- if ( ! appHostCompatabilityCheck ? . IsCompatableAppHost ?? throw new InvalidOperationException ( "IsCompatableAppHost is null" ) )
79+ if ( ! watch )
8080 {
81- return ExitCodeConstants . FailedToDotnetRunAppHost ;
82- }
83-
84- var watch = parseResult . GetValue < bool > ( "--watch" ) ;
81+ var buildExitCode = await AppHostHelper . BuildAppHostAsync ( _runner , effectiveAppHostProjectFile , cancellationToken ) ;
8582
86- var buildExitCode = await AppHostHelper . BuildAppHostAsync ( _runner , effectiveAppHostProjectFile , cancellationToken ) ;
83+ if ( buildExitCode != 0 )
84+ {
85+ AnsiConsole . MarkupLine ( $ "[red bold]:thumbs_down: The project could not be built. For more information run with --debug switch.[/]") ;
86+ return ExitCodeConstants . FailedToBuildArtifacts ;
87+ }
88+ }
89+
90+ appHostCompatabilityCheck = await AppHostHelper . CheckAppHostCompatabilityAsync ( _runner , effectiveAppHostProjectFile , cancellationToken ) ;
8791
88- if ( buildExitCode != 0 )
92+ if ( ! appHostCompatabilityCheck ? . IsCompatableAppHost ?? throw new InvalidOperationException ( "IsCompatableAppHost is null" ) )
8993 {
90- AnsiConsole . MarkupLine ( $ "[red bold]:thumbs_down: The project could not be built. For more information run with --debug switch.[/]") ;
91- return ExitCodeConstants . FailedToBuildArtifacts ;
94+ return ExitCodeConstants . FailedToDotnetRunAppHost ;
9295 }
9396
9497 var backchannelCompletitionSource = new TaskCompletionSource < AppHostBackchannel > ( ) ;
9598
9699 var pendingRun = _runner . RunAsync (
97100 effectiveAppHostProjectFile ,
98101 watch ,
99- true ,
102+ ! watch ,
100103 Array . Empty < string > ( ) ,
101104 env ,
102105 backchannelCompletitionSource ,
0 commit comments