您好我想在C#中以编程方式编译解决方案。但问题是,如果我的解决方案在框架4.5中,一切正常(编译完美),但如果我的解决方案在框架3.5中不起作用。
请参阅我的代码:
string compile(string sln)
{
ProjectCollection pc = new ProjectCollection();
Dictionary<string, string> GlobalProperty = new Dictionary<string, string>();
BuildRequestData BuidlRequest = new BuildRequestData(sln, GlobalProperty, null, new string[] { "Build" }, null);
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), BuidlRequest);
if (buildResult.OverallResult == BuildResultCode.Failure)
{
throw new Exception("Compiling Error");
}
}
错误:Error