Have got this error when trying to compile?
Issue #761 Edit code: Automatically add required attributes the compiler needs · Issue #761 · 0xd4d/dnSpy
Well they are working with the fix but here is the workaround
Remove all assemblies. You can open your assembly to edit later if you want.
Copy the code from AndnixSH/Free-Shared-Mod-Codes-Collections
Edit any code you want to edit
Paste "using System.Runtime.InteropServices;" and the namespace System.Runtime.CompilerServices code below the other namespace code (See screenshow below)
Compile it. It should compile without any error.
Please note, you must add the namespace System.Runtime.InteropServices code again every code changes
---------------------------------------------------------------
If you want to copy the code manually, follow this steps.
Click File -> Open from GAC
Search mscorlib, select mscorlib 4.0.0.0 and click OK
Search CompilationRelaxationsAttribute and copy the whole code to somewhere else for later use.
Issue #761 Edit code: Automatically add required attributes the compiler needs · Issue #761 · 0xd4d/dnSpy
Well they are working with the fix but here is the workaround
Remove all assemblies. You can open your assembly to edit later if you want.
Copy the code from AndnixSH/Free-Shared-Mod-Codes-Collections
Edit any code you want to edit
Paste "using System.Runtime.InteropServices;" and the namespace System.Runtime.CompilerServices code below the other namespace code (See screenshow below)
Compile it. It should compile without any error.
Please note, you must add the namespace System.Runtime.InteropServices code again every code changes
---------------------------------------------------------------
If you want to copy the code manually, follow this steps.
Click File -> Open from GAC
Search mscorlib, select mscorlib 4.0.0.0 and click OK
Search CompilationRelaxationsAttribute and copy the whole code to somewhere else for later use.
Last edited: