@@ -27,7 +27,7 @@ public static string GetNuGetConfigPathFor(string targetFramework) =>
2727 public string Id { get ; init ; }
2828 public string RootDir { get ; init ; }
2929 public string LogPath { get ; init ; }
30- public string AppHostProjectDirectory => Path . Combine ( RootDir , $ " { Id } .AppHost" ) ;
30+ public string AppHostProjectDirectory { get ; init ; }
3131 public string ServiceDefaultsProjectPath => Path . Combine ( RootDir , $ "{ Id } .ServiceDefaults") ;
3232 public string TestsProjectDirectory => Path . Combine ( RootDir , $ "{ Id } .Tests") ;
3333 public string ? DashboardUrl { get ; private set ; }
@@ -38,13 +38,14 @@ public static string GetNuGetConfigPathFor(string targetFramework) =>
3838 private readonly ITestOutputHelper _testOutput ;
3939 private readonly BuildEnvironment _buildEnv ;
4040
41- public AspireProject ( string id , string baseDir , ITestOutputHelper testOutput , BuildEnvironment buildEnv )
41+ public AspireProject ( string id , string baseDir , ITestOutputHelper testOutput , BuildEnvironment buildEnv , string ? relativeAppHostProjectDir = null )
4242 {
4343 Id = id ;
4444 RootDir = baseDir ;
4545 _testOutput = testOutput ;
4646 _buildEnv = buildEnv ;
4747 LogPath = Path . Combine ( _buildEnv . LogRootPath , Id ) ;
48+ AppHostProjectDirectory = relativeAppHostProjectDir ?? Path . Combine ( RootDir , $ "{ Id } .AppHost") ;
4849 }
4950
5051 protected void InitPaths ( )
@@ -102,7 +103,11 @@ public static async Task<AspireProject> CreateNewTemplateProjectAsync(string id,
102103 return project ;
103104 }
104105
105- public async Task StartAppHostAsync ( string [ ] ? extraArgs = default , Action < ProcessStartInfo > ? configureProcess = null , bool noBuild = true , CancellationToken token = default )
106+ public async Task StartAppHostAsync ( string [ ] ? extraArgs = default ,
107+ Action < ProcessStartInfo > ? configureProcess = null ,
108+ bool noBuild = true ,
109+ bool expectEndpointsHook = true ,
110+ CancellationToken token = default )
106111 {
107112 if ( IsRunning )
108113 {
@@ -207,7 +212,7 @@ public async Task StartAppHostAsync(string[]? extraArgs = default, Action<Proces
207212 AppHostProcess . BeginOutputReadLine ( ) ;
208213 AppHostProcess . BeginErrorReadLine ( ) ;
209214
210- var successfulStartupTask = Task . WhenAll ( appRunning . Task , projectsParsed . Task ) ;
215+ var successfulStartupTask = Task . WhenAll ( appRunning . Task , expectEndpointsHook ? projectsParsed . Task : Task . CompletedTask ) ;
211216 var startupTimeoutTask = Task . Delay ( TimeSpan . FromSeconds ( AppStartupWaitTimeoutSecs ) , token ) ;
212217
213218 string outputMessage ;
@@ -264,7 +269,7 @@ public async Task StartAppHostAsync(string[]? extraArgs = default, Action<Proces
264269 public async Task BuildAsync ( string [ ] ? extraBuildArgs = default , CancellationToken token = default )
265270 {
266271 using var restoreCmd = new DotNetCommand ( _testOutput , buildEnv : _buildEnv , label : "restore" )
267- . WithWorkingDirectory ( Path . Combine ( RootDir , $ " { Id } .AppHost" ) ) ;
272+ . WithWorkingDirectory ( AppHostProjectDirectory ) ;
268273 var res = await restoreCmd . ExecuteAsync ( $ "restore \" -bl:{ Path . Combine ( LogPath ! , $ "{ Id } -restore.binlog") } \" /p:TreatWarningsAsErrors=true") ;
269274 res . EnsureSuccessful ( ) ;
270275
@@ -274,7 +279,7 @@ public async Task BuildAsync(string[]? extraBuildArgs = default, CancellationTok
274279 buildArgs += " " + string . Join ( " " , extraBuildArgs ) ;
275280 }
276281 using var buildCmd = new DotNetCommand ( _testOutput , buildEnv : _buildEnv , label : "build" )
277- . WithWorkingDirectory ( Path . Combine ( RootDir , $ " { Id } .AppHost" ) ) ;
282+ . WithWorkingDirectory ( AppHostProjectDirectory ) ;
278283 res = await buildCmd . ExecuteAsync ( buildArgs ) ;
279284 res . EnsureSuccessful ( ) ;
280285 }
0 commit comments