获取csc.exe路径

using System.Runtime.InteropServices;
var frameworkPath = RuntimeEnvironment.GetRuntimeDirectory();
var cscPath = Path.Combine(frameworkPath, "csc.exe");

Console.WriteLine(frameworkPath);  // C:WindowsMicrosoft.NETFrameworkv4.0.30319
Console.WriteLine(cscPath); }      // C:WindowsMicrosoft.NETFrameworkv4.0.30319csc.exe
原文地址:https://www.cnblogs.com/talentzemin/p/10944493.html