游戏开发unity杂项系列: CSharpCodeProvider could not be found in the namespace Micrrosoft.CSharp

    unity 进行build and run 时报错,The type name 'CSharpCodeProvider' could not be found in the namespace 'Microsoft.CSharp'. This type has been forwarded to assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.

看到提示Version=4.0.0.0,应该是.Net 4.0的程序集才有,需要设置unity使用的.Net版本。Edit->Project Setting->Player->APiCompatibilityLevel

游戏开发unity杂项系列: CSharpCodeProvider could not be found in the namespace Micrrosoft.CSharp

设置为4.x,编译通过