@@ -72,7 +72,6 @@ void AddTestData(bool runOutsideProjectDirectory)
72
72
73
73
[ Theory , TestCategory ( "no-fingerprinting" ) ]
74
74
[ MemberData ( nameof ( TestDataForAppBundleDir ) ) ]
75
- [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/108107" ) ]
76
75
public async Task RunWithDifferentAppBundleLocations ( bool runOutsideProjectDirectory , string extraProperties )
77
76
=> await BrowserRunTwiceWithAndThenWithoutBuildAsync ( Configuration . Release , extraProperties , runOutsideProjectDirectory ) ;
78
77
@@ -83,13 +82,25 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(Configuration con
83
82
UpdateBrowserMainJs ( ) ;
84
83
85
84
string workingDir = runOutsideProjectDirectory ? BuildEnvironment . TmpPath : _projectDir ;
85
+ string projectFilePath = info . ProjectFilePath ;
86
+ if ( runOutsideProjectDirectory )
87
+ {
88
+ // When running outside, the project is in a subdirectory of workingDir
89
+ string ? directoryName = Path . GetDirectoryName ( projectFilePath ) ;
90
+ if ( directoryName == null )
91
+ throw new InvalidOperationException ( $ "Invalid project file path: { projectFilePath } ") ;
92
+
93
+ string projectDirName = Path . GetFileName ( directoryName ) ;
94
+ string projectFileName = Path . GetFileName ( projectFilePath ) ;
95
+ projectFilePath = Path . Combine ( projectDirName , projectFileName ) ;
96
+ }
86
97
87
98
{
88
99
using var runCommand = new RunCommand ( s_buildEnv , _testOutput )
89
100
. WithWorkingDirectory ( workingDir ) ;
90
101
91
102
await using var runner = new BrowserRunner ( _testOutput ) ;
92
- var page = await runner . RunAsync ( runCommand , $ "run --no-silent -c { config } --project \" { info . ProjectName } .csproj \" --forward-console") ;
103
+ var page = await runner . RunAsync ( runCommand , $ "run --no-silent -c { config } --project \" { projectFilePath } \" --forward-console") ;
93
104
await runner . WaitForExitMessageAsync ( TimeSpan . FromMinutes ( 2 ) ) ;
94
105
Assert . Contains ( "Hello, Browser!" , string . Join ( Environment . NewLine , runner . OutputLines ) ) ;
95
106
}
@@ -99,7 +110,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(Configuration con
99
110
. WithWorkingDirectory ( workingDir ) ;
100
111
101
112
await using var runner = new BrowserRunner ( _testOutput ) ;
102
- var page = await runner . RunAsync ( runCommand , $ "run --no-silent -c { config } --no-build --project \" { info . ProjectName } .csproj \" --forward-console") ;
113
+ var page = await runner . RunAsync ( runCommand , $ "run --no-silent -c { config } --no-build --project \" { projectFilePath } \" --forward-console") ;
103
114
await runner . WaitForExitMessageAsync ( TimeSpan . FromMinutes ( 2 ) ) ;
104
115
Assert . Contains ( "Hello, Browser!" , string . Join ( Environment . NewLine , runner . OutputLines ) ) ;
105
116
}
0 commit comments