File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -225,14 +225,16 @@ private void SetContentRoot(IWebHostBuilder builder)
225
225
}
226
226
}
227
227
228
- private static string GetContentRootFromFile ( string file )
228
+ private static string ? GetContentRootFromFile ( string file )
229
229
{
230
230
var data = JsonSerializer . Deserialize < IDictionary < string , string > > ( File . ReadAllBytes ( file ) ) ! ;
231
231
var key = typeof ( TEntryPoint ) . Assembly . GetName ( ) . FullName ;
232
232
233
+ // If the `ContentRoot` is not provided in the app manifest, then return null
234
+ // and fallback to setting the content root relative to the entrypoint's assembly.
233
235
if ( ! data . TryGetValue ( key , out var contentRoot ) )
234
236
{
235
- throw new KeyNotFoundException ( $ "Could not find content root for project ' { key } ' in test manifest file ' { file } '" ) ;
237
+ return null ;
236
238
}
237
239
238
240
return ( contentRoot == "~" ) ? AppContext . BaseDirectory : contentRoot ;
You can’t perform that action at this time.
0 commit comments