File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
src/System.CommandLine.DragonFruit Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -311,9 +311,26 @@ public static Option BuildOption(this ParameterDescriptor parameter)
311
311
312
312
private static string GetDefaultXmlDocsFileLocation ( Assembly assembly )
313
313
{
314
- return Path . Combine (
315
- Path . GetDirectoryName ( assembly . Location ) ,
316
- Path . GetFileNameWithoutExtension ( assembly . Location ) + ".xml" ) ;
314
+ if ( ! string . IsNullOrEmpty ( assembly . Location ) )
315
+ {
316
+ return Path . Combine (
317
+ Path . GetDirectoryName ( assembly . Location ) ,
318
+ Path . GetFileNameWithoutExtension ( assembly . Location ) + ".xml" ) ;
319
+ }
320
+
321
+ // Assembly.Location is empty for bundled (i.e, single-file) assemblies, but we can't be confident
322
+ // that whenever Assembly.Location is empty the corresponding assembly is bundled.
323
+ //
324
+ // Provisionally assume that the entry-assembly is bundled. If this query is for something other
325
+ // than the entry-assembly, then return nothing.
326
+ if ( assembly == Assembly . GetEntryAssembly ( ) )
327
+ {
328
+ return Path . Combine (
329
+ AppContext . BaseDirectory ,
330
+ assembly . GetName ( ) . Name + ".xml" ) ;
331
+ }
332
+
333
+ return string . Empty ;
317
334
}
318
335
}
319
336
}
You can’t perform that action at this time.
0 commit comments