|
|
|
@ -19,6 +19,7 @@
@@ -19,6 +19,7 @@
|
|
|
|
|
using System; |
|
|
|
|
using System.Linq; |
|
|
|
|
using ICSharpCode.NRefactory.CSharp; |
|
|
|
|
using ICSharpCode.NRefactory.Semantics; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.Decompiler.CSharp.Transforms |
|
|
|
|
{ |
|
|
|
@ -54,4 +55,27 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
@@ -54,4 +55,27 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This transform is used to remove assembly-attributes that are generated by the compiler,
|
|
|
|
|
/// thus don't need to be declared. (We have to remove them, in order to avoid conflicts while compiling.)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>This transform is only enabled, when exporting a full assembly as project.</remarks>
|
|
|
|
|
public class RemoveCompilerGeneratedAssemblyAttributes : IAstTransform |
|
|
|
|
{ |
|
|
|
|
public void Run(AstNode rootNode, TransformContext context) |
|
|
|
|
{ |
|
|
|
|
foreach (var section in rootNode.Children.OfType<AttributeSection>()) { |
|
|
|
|
if (section.AttributeTarget != "assembly") |
|
|
|
|
continue; |
|
|
|
|
foreach (var attribute in section.Attributes) { |
|
|
|
|
var trr = attribute.Type.Annotation<TypeResolveResult>(); |
|
|
|
|
if (trr != null && trr.Type.FullName == "System.Runtime.Versioning.TargetFrameworkAttribute") |
|
|
|
|
attribute.Remove(); |
|
|
|
|
} |
|
|
|
|
if (section.Attributes.Count == 0) |
|
|
|
|
section.Remove(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|