Tutorial dnSpy - How to fix Missing compiler required member

AndnixSH

PMT Elite Modder
Original poster
Staff member
Modding-Team
Jun 27, 2017
4,756
300,791
1,213
Modding World
Have got this error when trying to compile?

XQJ6jhu.png

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)

RP01cjT.png


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

pBhLx33.png


Search mscorlib, select mscorlib 4.0.0.0 and click OK

JJQjiDQ.png


Search CompilationRelaxationsAttribute and copy the whole code to somewhere else for later use.
 
Last edited: