- Home /
Is it possible to use c# dynamics when using the incremental compiler?
I am trying to use c# dynamics with the incremental compiler, but I keep getting this error:
error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
I did some searching, and according to this stackoverflow post, to use dynamics with Roslyn you need to add a project reference to Microsoft.CSharp.dll. I tried doing this in my IDE and by editing msc.rsp, but the errors are still there.
Is it possible to make the incremental compiler reference an assembly?
Answer by JimmyCushnie · Nov 11, 2018 at 06:42 AM
I finally figured it out. Posting the solution here to hopefully help future people. Hi, future people!
When using Unity's incremental Roslyn compiler, to add an assembly dll reference, which is necessary to use c# dynamics, you need to to the following:
Find the path of your Unity Editor installation
Go into the following subfolder: [Version of Unity]\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\Facades
Copy-paste a copy of the dll you want to use into that folder. To use dynamics you need Microsoft.CSharp.dll, which can be found at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5.
Dependencies seem to be automatically sorted out; even though Microsoft.CSharp.dll has like 5000 dependencies, I was still able to use it without copy-pasting any of them.