@@ -9,19 +9,20 @@ internal class Assembly : Extraction.Entities.Location
9
9
10
10
private readonly string assemblyPath ;
11
11
private readonly IAssemblySymbol assembly ;
12
+ private readonly bool isOutputAssembly ;
12
13
13
14
private Assembly ( Context cx , Microsoft . CodeAnalysis . Location ? init )
14
15
: base ( cx , init )
15
16
{
16
- if ( init is null )
17
+ isOutputAssembly = init is null ;
18
+ if ( isOutputAssembly )
17
19
{
18
- // This is the output assembly
19
20
assemblyPath = cx . Extractor . OutputPath ;
20
21
assembly = cx . Compilation . Assembly ;
21
22
}
22
23
else
23
24
{
24
- assembly = init . MetadataModule ! . ContainingAssembly ;
25
+ assembly = init ! . MetadataModule ! . ContainingAssembly ;
25
26
var identity = assembly . Identity ;
26
27
var idString = identity . Name + " " + identity . Version ;
27
28
assemblyPath = cx . Extractor . GetAssemblyFile ( idString ) ;
@@ -32,8 +33,13 @@ public override void Populate(TextWriter trapFile)
32
33
{
33
34
if ( assemblyPath is not null )
34
35
{
35
- trapFile . assemblies ( this , File . Create ( Context , assemblyPath ) , assembly . ToString ( ) ?? "" ,
36
- assembly . Identity . Name , assembly . Identity . Version . ToString ( ) ) ;
36
+ var isBuildlessOutputAssembly = isOutputAssembly && Context . Extractor . Mode . HasFlag ( ExtractorMode . Standalone ) ;
37
+ var identifier = isBuildlessOutputAssembly
38
+ ? ""
39
+ : assembly . ToString ( ) ?? "" ;
40
+ var name = isBuildlessOutputAssembly ? "" : assembly . Identity . Name ;
41
+ var version = isBuildlessOutputAssembly ? "" : assembly . Identity . Version . ToString ( ) ;
42
+ trapFile . assemblies ( this , File . Create ( Context , assemblyPath ) , identifier , name , version ) ;
37
43
}
38
44
}
39
45
@@ -68,8 +74,16 @@ public static Assembly CreateOutputAssembly(Context cx)
68
74
69
75
public override void WriteId ( EscapingTextWriter trapFile )
70
76
{
71
- trapFile . Write ( assembly . ToString ( ) ) ;
72
- if ( ! ( assemblyPath is null ) )
77
+ if ( isOutputAssembly && Context . Extractor . Mode . HasFlag ( ExtractorMode . Standalone ) )
78
+ {
79
+ trapFile . Write ( "buildlessOutputAssembly" ) ;
80
+ }
81
+ else
82
+ {
83
+ trapFile . Write ( assembly . ToString ( ) ) ;
84
+ }
85
+
86
+ if ( assemblyPath is not null )
73
87
{
74
88
trapFile . Write ( "#file:///" ) ;
75
89
trapFile . Write ( assemblyPath . Replace ( "\\ " , "/" ) ) ;
0 commit comments