"mono\\mono\\mini\\mono.exe");
if (!File.Exists (windowsMonoPath))
throw new FileNotFoundException ("Windows mono path not found: " + windowsMonoPath);
-#if NET_4_0
- windowsMcsPath =
- Path.Combine (p, "4.0\\dmcs.exe");
-#else
- windowsMcsPath =
- Path.Combine (p, "2.0\\gmcs.exe");
-#endif
+
+ windowsMcsPath = Path.Combine (p, "4.5\\mcs.exe");
if (!File.Exists (windowsMcsPath))
-#if NET_4_0
- windowsMcsPath =
- Path.Combine(
- Path.GetDirectoryName (p),
- "lib\\net_4_0\\dmcs.exe");
-#else
- windowsMcsPath =
- Path.Combine(
- Path.GetDirectoryName (p),
- "lib\\net_2_0\\gmcs.exe");
-#endif
+ windowsMcsPath = Path.Combine(Path.GetDirectoryName (p), "lib\\build\\mcs.exe");
+
if (!File.Exists (windowsMcsPath))
throw new FileNotFoundException ("Windows mcs path not found: " + windowsMcsPath);
}
CompilerResults results=new CompilerResults(options.TempFiles);
Process mcs=new Process();
-
+
// FIXME: these lines had better be platform independent.
if (Path.DirectorySeparatorChar == '\\') {
mcs.StartInfo.FileName = windowsMonoPath;
mcs.StartInfo.Arguments = "\"" + windowsMcsPath + "\" " +
BuildArgs (options, fileNames, ProviderOptions);
} else {
- // FIXME: This is a temporary hack to make code genaration work in 2.0+
-#if NET_4_0
- mcs.StartInfo.FileName="dmcs";
-#else
- mcs.StartInfo.FileName="gmcs";
-#endif
+ mcs.StartInfo.FileName="mcs";
mcs.StartInfo.Arguments=BuildArgs(options, fileNames, ProviderOptions);
}
mcsOutput = new StringCollection ();
mcsOutMutex = new Mutex ();
-
+#if !NET_4_0
+ /*
+ * !:. KLUDGE WARNING .:!
+ *
+ * When running the 2.0 test suite some assemblies will invoke mcs via
+ * CodeDOM and the new mcs process will find the MONO_PATH variable in its
+ * environment pointing to the net_2_0 library which will cause the runtime
+ * to attempt to load the 2.0 corlib into 4.0 process and thus mcs will
+ * fail. At the same time, we must not touch MONO_PATH when running outside
+ * the test suite, thus the kludge.
+ *
+ * !:. KLUDGE WARNING .:!
+ */
+ if (Environment.GetEnvironmentVariable ("MONO_TESTS_IN_PROGRESS") != null) {
+ string monoPath = Environment.GetEnvironmentVariable ("MONO_PATH");
+ if (!String.IsNullOrEmpty (monoPath)) {
+ monoPath = monoPath.Replace ("/class/lib/net_2_0", "/class/lib/net_4_0");
+ mcs.StartInfo.EnvironmentVariables ["MONO_PATH"] = monoPath;
+ }
+ }
+#endif
+/*
string monoPath = Environment.GetEnvironmentVariable ("MONO_PATH");
- if (monoPath == null)
+ if (monoPath != null)
monoPath = String.Empty;
-
+
string privateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
if (privateBinPath != null && privateBinPath.Length > 0)
monoPath = String.Format ("{0}:{1}", privateBinPath, monoPath);
else
dict.Add ("MONO_PATH", monoPath);
}
-
+*/
+ /*
+ * reset MONO_GC_PARAMS - we are invoking compiler possibly with another GC that
+ * may not handle some of the options causing compilation failure
+ */
+ mcs.StartInfo.EnvironmentVariables ["MONO_GC_PARAMS"] = String.Empty;
+
mcs.StartInfo.CreateNoWindow=true;
mcs.StartInfo.UseShellExecute=false;
mcs.StartInfo.RedirectStandardOutput=true;
using (FileStream fs = File.OpenRead(options.OutputAssembly)) {
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
- results.CompiledAssembly = Assembly.Load(buffer, null, options.Evidence);
+ results.CompiledAssembly = Assembly.Load(buffer, null);
fs.Close();
}
} else {
switch (langver) {
case "2.0":
- args.Append ("/langversion:ISO-2");
+ args.Append ("/langversion:ISO-2 ");
break;
case "3.5":
}
}
+#if NET_4_5
+ args.Append("/sdk:4.5");
+#elif NET_4_0
+ args.Append("/sdk:4");
+#else
+ args.Append("/sdk:2");
+#endif
+
args.Append (" -- ");
foreach (string source in fileNames)
args.AppendFormat("\"{0}\" ",source);