[2021.1.6f] Error "...mono.exe: The system cannot find the file specified." using reflection.emit

Basically, I got some Reflection.Emit that emits some dynamic code. I am not using Il2cpp neither UWP just plain old windows. It works fine in the editor but errors in the build.

The full error is

SystemException: Error running ...projectDir...\mono\mini\mono.exe: The system cannot find the file specified.

The build is in folder …projectDir…\builds\build1

So it is trying to find something using project specific path which is also bad.

The place where the error is called is

line 128

Win32Exception.GetErrorMessage (exc.NativeErrorCode)));```

Does anyone have experience running Emit in build?
1 Like

That’s nice but you didn’t say if the mini mono.exe is also there, and if you can run it manually or not.

If it is there it might need some kind of fancy new Windows permissions.

It might not even be there.

nope, no such folder exists

Hi all, I’m having this exact situation as well. I am in need of figuring out how to get code to compile dynamically without getting the error: “Error running <projects_dir>\mono\mini\mono.exe: The system cannot find the file specified.” All dynamic compilation works beautifully within the editor (ver 2021.3.15f1) but fails when running as a standalone. Does anyone else have experience with this?