Re-compile C# assemblies

I’m using Mono.Cecil to inject code to the assemblies in my project. However, I want to do the injection before I generate a build and then remove the injected code once the build is finished. Is there a way to recompile the C# assemblies using an Editor script?

Try with UnityEditorInternal.InternalEditorUtility.RequestScriptReload ()