Path.GetDirectoryName (
Path.GetDirectoryName (p)),
"bin\\mono.exe");
+ if (!File.Exists (windowsMonoPath))
+ windowsMonoPath = Path.Combine (
+ Path.GetDirectoryName (
+ Path.GetDirectoryName (
+ Path.GetDirectoryName (p))),
+ "mono\\mono\\mini\\mono.exe");
+ if (!File.Exists (windowsMonoPath))
+ throw new FileNotFoundException ("Windows mono path not found: " + windowsMonoPath);
#if NET_2_0
windowsMcsPath =
Path.Combine (p, "2.0\\gmcs.exe");
windowsMcsPath =
Path.Combine (p, "1.0\\mcs.exe");
#endif
+ if (!File.Exists (windowsMcsPath))
+#if NET_2_0
+ windowsMcsPath =
+ Path.Combine(
+ Path.GetDirectoryName (p),
+ "lib\\net_2_0\\gmcs.exe");
+#else
+ windowsMcsPath =
+ Path.Combine(
+ Path.GetDirectoryName (p),
+ "lib\\default\\mcs.exe");
+#endif
+ if (!File.Exists (windowsMcsPath))
+ throw new FileNotFoundException ("Windows mcs path not found: " + windowsMcsPath);
}
}
Process mcs=new Process();
string mcs_output;
+ string mcs_stdout;
string[] mcs_output_lines;
// FIXME: these lines had better be platform independent.
if (Path.DirectorySeparatorChar == '\\') {
mcs.Start();
// If there are a few kB in stdout, we might lock
mcs_output=mcs.StandardError.ReadToEnd();
- mcs.StandardOutput.ReadToEnd ();
+ mcs_stdout=mcs.StandardOutput.ReadToEnd ();
mcs.WaitForExit();
results.NativeCompilerReturnValue = mcs.ExitCode;
} finally {
}
}
if (loadIt) {
+ if (!File.Exists (options.OutputAssembly)) {
+ throw new Exception ("Compiler failed to produce the assembly. Stderr='"
+ +mcs_output+"', Stdout='"+mcs_stdout+"'");
+ }
if (options.GenerateInMemory) {
using (FileStream fs = File.OpenRead(options.OutputAssembly)) {
byte[] buffer = new byte[fs.Length];
options.OutputAssembly = GetTempFileNameWithExtension (options.TempFiles, "dll", !options.GenerateInMemory);
args.AppendFormat("/out:\"{0}\" ",options.OutputAssembly);
- if (null != options.ReferencedAssemblies)
- {
- foreach (string import in options.ReferencedAssemblies) {
- if (import == null || import.Length == 0)
- continue;
+ foreach (string import in options.ReferencedAssemblies) {
+ if (import == null || import.Length == 0)
+ continue;
- args.AppendFormat("/r:\"{0}\" ",import);
- }
+ args.AppendFormat("/r:\"{0}\" ",import);
}
if (options.CompilerOptions != null) {
args.Append (options.CompilerOptions);
args.Append (" ");
}
-
+
+#if NET_2_0
+ foreach (string embeddedResource in options.EmbeddedResources) {
+ args.AppendFormat("/resource:\"{0}\" ", embeddedResource);
+ }
+
+ foreach (string linkedResource in options.LinkedResources) {
+ args.AppendFormat("/linkresource:\"{0}\" ", linkedResource);
+ }
+#endif
+
args.Append (" -- ");
foreach (string source in fileNames)
args.AppendFormat("\"{0}\" ",source);