我生成了一个新进程并让它像这样调用 F# 编译器:
var exeName = args[0];
var commandLine = args[1];
using (var process = new Process())
{
process.StartInfo = new ProcessStartInfo(exeName, commandLine);
process.StartInfo.UseShellExecute = true;
process.StartInfo.LoadUserProfile = true;
process.Start();
}
我传入的参数是 fsc.exe 的路径和我要构建的代码的参数。
结果是异常:
Unhandled Exception: System.ArgumentException: chop_extension
at Internal.Utilities.Filename.chop_extension(String s)
at Microsoft.FSharp.Compiler.Build.TcConfigBuilder.DecideNames(FSharpList`1 sourceFiles)
at Microsoft.FSharp.Compiler.Driver.main1(String[] argv)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.ErrorLogger.errorRecovery(Exception exn, range m)
at Microsoft.FSharp.Compiler.Driver.main1(String[] argv)
at Microsoft.FSharp.Compiler.Driver.main(String[] argv)
at Microsoft.FSharp.Compiler.CommandLineMain.main(String[] argv)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.ErrorLogger.errorRecovery(Exception exn, range m)
at Microsoft.FSharp.Compiler.CommandLineMain.main(String[] argv)
但是,当我从命令提示符运行相同的命令和参数时,它编译时没有错误
知道是什么原因造成的吗?