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)
225225 }
226226 }
227227
228- private static string GetContentRootFromFile ( string file )
228+ private static string ? GetContentRootFromFile ( string file )
229229 {
230230 var data = JsonSerializer . Deserialize < IDictionary < string , string > > ( File . ReadAllBytes ( file ) ) ! ;
231231 var key = typeof ( TEntryPoint ) . Assembly . GetName ( ) . FullName ;
232232
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.
233235 if ( ! data . TryGetValue ( key , out var contentRoot ) )
234236 {
235- throw new KeyNotFoundException ( $ "Could not find content root for project ' { key } ' in test manifest file ' { file } '" ) ;
237+ return null ;
236238 }
237239
238240 return ( contentRoot == "~" ) ? AppContext . BaseDirectory : contentRoot ;
You can’t perform that action at this time.
0 commit comments